name=input("Enter your name:")
currentTime = int(time.strftime('%H'))
if currentTime < 12 :
print('Good morning,'+name)
elif currentTime > 12 :
print('Good afternoon,'+name)
else :
print('Good evening,'+name)
def main():
import random
guess: int = input('Enter a number the between 1 and 2 :')
if guess <= "2":
num: int = random.randint(1, 2)
print("the number is ", num)
if num == guess: *##this if statement is not working*
print('you won'
'your promote to level 2')
else:
print("You lost", ",Lets try again")
repeat = input('Do you want to try again:')
if repeat == "yes":
main()
else:
print("Good bye")
exit()
else:
print("the number you entered is grater than 5,Please enter a number between 1 and 2")
main()
main()
if statement in this code not working(I have mentioned that if statement in code) But else statement is working to both conditions. Plzz help me
Aucun commentaire:
Enregistrer un commentaire