Random number generator game, if even number then you win anf if odd number your friend wins.
This is a random number generator game. It uses the randomint() and def() functions. This code generates a random number from
1-10(you can change the range if you wish). Then if you were to get an even number it will print "You win" and if you were to get an odd number it prints "Friend wins".
-Hope it helps.
import random
def game():
ran=(random.randint(0,10))
print(ran)
if ran%2==0:
print("You win")
else:
print("friend wins")
game()
Voters
GREAT
@udit4006 Thank you so much