fr0stn1k

rock-paper-scissors

Nov 20th, 2020
1,240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.76 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. import random
  4.  
  5. list = ['Камень', 'Ножницы', 'Бумага']
  6. scoreboard = {}
  7.  
  8. print("Введите ваше имя:")
  9. scoreboard['name'] = input()
  10. scoreboard['score'] = 0
  11.  
  12. print('''Чтобы играть выберете один из вариантов: Камень, Ножницы или Бумага и нажмите ENTER''')
  13.  
  14. print('Если хотите закончить игру')
  15. print('Введите "Конец игры"')
  16.  
  17. print('')
  18.  
  19. while True:
  20.     a = str(input())
  21.     b = random.choice(list)
  22.     # print("debug")
  23.     if a.lower == 'конец игры':
  24.             #print('Пока')
  25.             break
  26.     elif (a.title == 'Камень' and b.title == 'Камень') or (a.title == 'Ножницы' and b.title == 'Ножницы') or (a.title == 'Бумага' and b.title == 'Бумага'):
  27.         print(b)
  28.         print('')
  29.         print('Ничья!')
  30.         print('')
  31.     elif (a.title == 'Камень' and b.title == 'Бумага') or (a.title == 'Бумага' and b.title == 'Ножницы') or (a.title == 'Ножницы' and b.title == 'Камень'):
  32.             print(b)
  33.             scoreboard['score'] = scoreboard['score'] - 1
  34.         print('\nКомпьютер победил! Попробуй еще раз\n')
  35.     elif (a.title == 'Камень' and b.title == 'Ножницы') or (a.title == 'Ножницы' and b.title == 'Бумага') or (a.title == 'Бумага' and b.title == 'Камень'):
  36.         print(b)
  37.         scoreboard['score'] = scoreboard['score'] + 1
  38.         print('\nТы победил! Но получится ли в следующий раз?\n')
  39.     else:
  40.         print('Я тебя не понял')
  41.  
  42. print("Поздравляю " + scoreboard['name'] + ", вами набрано " + str(scoreboard['score']) + " очков.")
  43.  
Advertisement
Add Comment
Please, Sign In to add comment