Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- while True:
- possible_variants = {'1': {'name': 'Scissor', 'beat': '3'}, '2': {"name": 'Rock', 'beat':'1'}, '3': {'name':'Paper', 'beat': '2'}}
- user_choice = input('\n'.join([f"{key} - {value['name']}" for key, value in possible_variants.items()]) + '\n')
- if user_choice in possible_variants.keys():
- pc_choice = random.choice(list(possible_variants.keys()))
- print(f'You won, pc choose {possible_variants[pc_choice]["name"]}' if possible_variants[user_choice]['beat'] == pc_choice else (f'You lose, pc choose {possible_variants[pc_choice]["name"]}' if possible_variants[pc_choice]['beat'] == user_choice else f'Its draw, you selected identity items, you {possible_variants[user_choice]["name"]} and pc {possible_variants[pc_choice]["name"]}'))
- else:
- print('Pls select someone from list')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement