Python Fundamental Exercises
  • 1. Introduction to Programming
  • 2. If Statements
  • 3. GUIs
  • 4. If Statements II
  • 5. Random Numbers
    • Randomness
    • Magic 8-Ball
    • A Number-Guessing Game
    • Fortune Cookie
    • Dice
    • One Shot Hi-Lo
    • Three-Card Monte
    • ▶️ Generate Random Numbers and Data Using the random Module
  • 6. While Loops
  • 7. Post-test Loops
  • 8. While Loops II
  • 9. For Loops
  • 10. Project
  • 11. Graphics
  • 12. Functions
  • 13. Project II
  • 14. Exceptions
  • 15. For Loops II
  • 16. Nested Loops
  • 17. File RW
  • 18. Lists
  • 19. Sorting
  • 20. Graphics II
  • 21. Dictionaries
  • 22. Classes: Fields
  • 23. Project III
  • 24. Classes: Methods
  • 25. Classes: Inheritance
  • 26. Project Euler
  • 27. Project IIII
Python Fundamental Exercises
  • »
  • 5. Random Numbers »
  • Fortune Cookie
  • View page source

Fortune Cookie¶

Write a program that simulates a random fortune from a fortune cookie. You must have at least six fortunes.

For bonus points, also add randomly-chosen lotto numbers to the fortune. In Texas, the lotto chooses 6 numbers, each from 1-54.

Name your file: fortune_cookie.py

Fortune cookie says: "You will find happiness with a new love."

Bonus output:

Fortune cookie says: "Stick with your wife."
    13 - 44 - 19 - 37 - 29 - 17

©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.

Creative Commons License

Next Previous

© Copyright 2021, Mr. Gallo.

Built with Sphinx using a theme provided by Read the Docs.