Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import random
  2. while True:
  3. possible_variants = {'1': {'name': 'Scissor', 'beat': '3'}, '2': {"name": 'Rock', 'beat':'1'}, '3': {'name':'Paper', 'beat': '2'}}
  4. user_choice = input('\n'.join([f"{key} - {value['name']}" for key, value in possible_variants.items()]) + '\n')
  5. if user_choice in possible_variants.keys():
  6. pc_choice = random.choice(list(possible_variants.keys()))
  7. 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"]}'))
  8. else:
  9. print('Pls select someone from list')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement