Dec-20-2020, 12:20 AM
(This post was last modified: Dec-20-2020, 12:20 AM by deanhystad.)
flip is a number. call is a string. They will never be equal. You have to either change flip to a string or call to a number (int).
I don't like using meaningless numbers, so I make my coin have Heads and Tails instead of 1 and 2.
I don't like using meaningless numbers, so I make my coin have Heads and Tails instead of 1 and 2.
import random coin = ('Heads', 'Tails') call = input(f'Call it {coin}: ') flip = random.choice(coin) if flip[0] == call[0].upper(): result = 'YOU WIN' else: result = 'YOU LOSE' print(f'\nIt landed on {flip}. {result}')