import random
score=2
heads=1
tails=2
while score>=2:
a= input("Heads or tails?")
if random.randint(heads,tails)==a:
score +=1
print("Yes it's correct!. Now your score is:",score)
else:
score -=1
print("Fail.now your score is:",score)
print("GAMEOVER You Lose ")
Guys I tried to write a code that when input asks to user if he/she writes down heads or tails python gives a random decision or whatever(heads or tails). But I couldn't manage to do it with strings. what I'am trying to do is I want to write tails for a input and if its true my score will be 2 and it goes till score become 1 BTW I'm sorry about my english
Aucun commentaire:
Enregistrer un commentaire