Dec-05-2019, 09:51 PM
Could you please help me a little?
Game is not written by me obviously.
Mine is an attempt to introduce a question with two outcomes.
If "yes" we play, if "no" end of the game. So far "yes" worked. Option with "no" does not work.
Where do I insert it?
Thank you very much in advance.
I do not get this logic yet.
Tried elif and else in different places but it did not work.
Game is not written by me obviously.
Mine is an attempt to introduce a question with two outcomes.
If "yes" we play, if "no" end of the game. So far "yes" worked. Option with "no" does not work.
Where do I insert it?
Thank you very much in advance.
I do not get this logic yet.
Tried elif and else in different places but it did not work.
play_more = input('Lets play this game,shall we? (Answer yes or no) ')
if play_more == 'yes':
print('Great! Lets guess a number!')
import random
n = random.randint(1, 99)
guess = int(input("Enter an integer from 1 to 99: "))
while n != "guess":
print
if guess < n:
print ("guess is low")
guess = int(input("Enter an integer from 1 to 99: "))
elif guess > n:
print ("guess is high")
guess = int(input("Enter an integer from 1 to 99: "))
else:
print ("you guessed it!")
break
print('')
print ('Game is over')
#The question is: how and where do I insert option for
#else print something and end program in case of answer is "no"?
