Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- username = input('Введите ваше имя')
- gamelist = ['Камень', 'Ножницы', 'Бумага']
- userpicklist, aipicklist = [], []
- userscore, aiscore, aipick = 0, 0, 0
- for i in range(0,3):
- userpick = 0
- if (aiscore == userscore + 2) or (userscore == aiscore + 2 ): break
- while userpick not in range(1, 4):
- userpick = int(input('1 - Камень, 2 - Ножницы, 3 - Бумага '))
- if userpick not in range(1, 4): print('Неправильный ввод')
- aipick = random.randint(1, 3)
- userpicklist.append(gamelist[userpick - 1])
- aipicklist.append(gamelist[aipick - 1])
- if (userpick == 1 and aipick == 2) or (userpick == 2 and aipick == 3) or (userpick == 3 and aipick == 1):
- userscore += 1
- elif userpick == aipick: pass
- else: aiscore += 1
- print('{0} - Компьютер'.format(username))
- for i in range(0,len(userpicklist)): print('{0} - {1}'.format(userpicklist[i], aipicklist[i]))
- if userscore > aiscore:
- print('Игрок {0} победил'.format(username))
- elif userscore == aiscore:
- print('Ничья')
- else:
- print('Компьютер победил')
Add Comment
Please, Sign In to add comment