from random import randint
firstnumber=randint (1,9)
print(firstnumber)
secondnumber=randint (1,9)
print(secondnumber)
a= str(firstnumber) + str(secondnumber)
print (a)
numbers= input("Enter 2 numbers")
b = int(numbers)
if b== int(a):
print ("You have won 10000 dollars")
elif int(b[1])==int(a[0]) and int(b[0])==int(a[0]):
print ("You have won 3000 dollars")
**elif int(b[0])== int(a[0]) or int(b[0])==int(a[1]) or int(b[1])==int(a[0]) or int(b[1])== int[1]:**
print ("You have won 1000 dollars")
else:
print ('Try again')
The program is supposed to determine 2 random numbers and put them together to create the lottery number. These 2 numbers should not be the same and the program should generate another 2 numbers to make a new lottery number, if these 2 numbers are the same. The program should not print the random numbers as this is the lottery winning number.
This is how the reward system would work if the lottery number was 53. If the person guesses the correct numbers in order (ie 53) the persons should win $10000 , if the person guesses the correct numbers in reverse order (ie 35) they should win $3000, and if they guess one of the numbers correctly (ie. 37 or 63 or 59 or 45), they should win $1000. Otherwise the program should print out (Try Again).
I basically want to know what how to fix my program (when the input is anything other then the input which wins them $10,000 the program fails because their is something wrong with the bolded line. I also want to know how to generate another lottery winning numbers if the 2 numbers randint generates is the same and I also want to know how to check the input to see if the input contains one of the lottery numbers.
bis an integer (b = int(numbers)), sob[0]won't work. Rather leaveba string, this will make things a lot easier.