Designing a Simple Lottery Machine: User Input & Prize Calculation

Click For Summary
SUMMARY

The discussion focuses on designing a simple lottery machine that allows users to select three numbers between 1 and 20 and randomly generates three winning numbers within the same range. The program calculates winnings based on the number of matches: no matches yield no winnings, one match results in $10, two matches yield $50, and three matches provide $200. Key programming concepts include user input handling, random number generation, and conditional statements to determine winnings.

PREREQUISITES
  • Basic programming concepts including loops and conditionals
  • Understanding of user input handling in programming
  • Knowledge of random number generation techniques
  • Familiarity with prize calculation logic
NEXT STEPS
  • Research how to implement user input in Python using the input() function
  • Learn about the random module in Python for generating random numbers
  • Explore conditional statements in Python to evaluate matches and calculate winnings
  • Study debugging techniques to test and validate the lottery machine program
USEFUL FOR

This discussion is beneficial for beginner programmers, hobbyists interested in game development, and anyone looking to understand basic programming concepts through practical application.

coso21
Messages
2
Reaction score
0
I need help writing the code for a simple lottery machine. Here are the key points.

Ask the user to choose 3 numbers between 1 and 20. Randomly generate 3 winning numbers that are between 1 and 20. Determine how many, if any, of the users numbers match the winning numbers. If (hypothetically) no matches doesn't win anything, 1 match wins $10, 2 matches wins $50 and 3 matches wins $200, tell the user how much they have theoretically won. Write down your program design process. How can you check if the program works?

Thanks to anyone who can help me out. It will be greatly appreciated.
 
Physics news on Phys.org
How about you do your own homework?
 
I'm just a beginner. All I know is that i need some loops but don't know how they are going to work...I need help
 

Similar threads

  • · Replies 75 ·
3
Replies
75
Views
9K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
10K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 9 ·
Replies
9
Views
6K
Replies
1
Views
2K