python-by-example-150-chall.../challenges52-59/challenge-054.py

10 lines
231 B
Python
Raw Normal View History

2019-07-18 17:44:06 +08:00
import random
choose = random.choice(['h', 't'])
ask = str(input('Choose heads or tails against computer! h|t : '))
if choose == ask:
print('You win')
else:
print('Bad luck')
print('computer choose is {0}'.format(choose))