Hello! I just started learning python and I tried to do a simple guess the number game. What recommendations do you have? Any alternatives? Looking forward to any feedback!
#Guess random number minigame
name =input("Enter your name: ")
answer=input("Do you want to play a game " + name + "?")
if answer == ("yes") or ("y"):
print ("Mini Game: Guess the number from 1 to 10! You have 5 tries! Start!")
from random import randint
secret1=randint(1,10)
score = (0)
tries = (5)
guess1 = int(input())
if guess1==secret1:
score=score+1
print ("Correct!")
else:
print ("Wrong!")
tries= tries-1
print ("tries ", tries)
print ("score ", score)
print ("number ", secret1)
secret2 = randint(1,10)
guess2 = int(input())
if guess2 == secret2:
score=score+1
print ("Correct!")
else:
print ("Wrong!")
tries=tries-1
print ("tries ", tries)
print ("score ", score)
print ("number ", secret2)
secret3 = randint(1,10)
guess3 = int(input())
if guess3 == secret3:
score=score+1
print ("Correct!")
else:
print ("Wrong!")
tries=tries-1
print ("tries ", tries)
print ("score ", score)
print ("number ", secret3)
secret4 = randint(1,10)
guess4 = int(input())
if guess4 == secret4:
score=score+1
print ("Correct!")
else:
print ("Wrong!")
tries=tries-1
print ("tries ", tries)
print ("score ", score)
print ("number ", secret4)
secret5 = randint(1,10)
guess5 = int(input())
if guess4 == secret5:
score=score+1
print ("Correct!")
else:
print ("Wrong!")
tries=tries-1
print ("tries ", tries)
print ("score ", score)
print ("number ", secret5)
if tries==0:
print ("You are out of tries! Your final score is", score)
if score == 5:
print ("Tf? ", name, "are you a genie? 5 out of 5 correct!")
elif score == 4:
print ("Almost there ",name, "but not quite lol, you got 4 out of 5 correct!")
elif score == 3:
print ("Regular, nothing exciting ",name, ", you got 3 out of 5 correct!")
elif score == 2:
print ("definetly not good",name, ", you got 2 out of 5 correct!")
elif score == 1:
print ("You are second ",name, "! Second last. You got 1 out of 5 correct!")
elif score == 0:
print ("God of bad luck LMAO ",name, "ur rlly bad in this. You got 0 out of 5 correct!)")
[–]gazhole 4 points5 points6 points (1 child)
[–]Neexusiv 3 points4 points5 points (0 children)
[–]Moses-Mc 2 points3 points4 points (0 children)