import random
purpose = random.randint(1, 10)
attempts = []
guess = int(input("Try to guess number between 1 to 10: "))
guess2 = guess + guess
while purpose != guess:
print ("Oh sorry your guess was wrong :( ")
attempts.append (guess)
guess = int(input("Try to guess again: "))
there I want to make that if you guessed same number for two times, for example guesses were [5, 4, 4, 7]- program writes "you have a short memory". I tried it with function but code just writes "<function short_memory at 0x7fa6d7e58430>" (short_memory was name of function)
if purpose == guess :
print ("Your guess was right!! ")
print ("your attempts was: ", attempts)
Aucun commentaire:
Enregistrer un commentaire