Each user has 100 credits, the user needs to input credits under 100 and the system needs to take the amount the user played and subtract that from the amount of credits the user had, then 3 numbers need to be randomly generated and the machine needs to check if the 3 numbers are the same. If it is the same the user wins double the credits than what they had and is added to the amount of credits they have. If yes to go again, if they won the credits must be added to start again but if they lost, credits must be lost.
from random import randint
def cred(credit):
n = int(input("Enter credit under 100: "))
credit = credit-n
rand1 = randint(0,10)
rand2 = randint(0,10)
rand3 = randint(0,10)
print("Random numbers are:", rand1,rand2,rand3)
if rand1 == rand2 == rand3:
bala=credit*2
credit =credit+bala
print("New credit is ", credit)
cred(credit)
else:
credit=0
print("You lost and New credit is ", credit)
exit()
#main
credit = 100
cred(credit)
Comments
Leave a comment