- 2
6. Generate a three-digit lottery number.
The program prompts the user to enter a three-digit number and determines whether the user wins according to the following rules: a. If the user input matches the lottery number in the exact order, the award is $10,000. b. If all the digits in the user input match all the digits in the lottery number, the award is $3,000. c. If one digit in the user input matches a digit in the lottery number, the award is $1,000.
12 odpowiedzi
+ 1
Do you have a code that doesn't work? We'd love to see it and then someone can help.
Attach it here from the code playground.
+ 1
I think you might need to look at how you take in user input.
Then, you want to compare the user's 3 digits exactly to the "lottery" digits.
If that doesn't match, compare each digits individually. I would iterate through an array.
If any one of those digits matches, then the user wins $1,000. If all 3 match, $3,000. If none match... nothing.
+ 1
Thank u :)
+ 1
Are you asking for an algorithms or what? Which language do you want to code with?
+ 1
I'm a beginner learning python
Thank u everyone...I have done that
0
import random
a=random.randint(0,9)
import random
b=random.randint(0,9)
import random
c=random.randint(0,9)
print (a,b,c)
0
Can't understand what to do next
0
minahil ashfaq
I note that you haven't commenced any courses, which may explain why you don't know how to proceed.
Start doing the courses, and you will start to develop the solutions.
0
Here you go.
https://code.sololearn.com/cTK7LjRXUMOS/?ref=app
0
Input 3 digits auto generate 3 digits with code in JavaScript