voytyukk
09.05.2020 07:10

Задание Напишите игру Rock, paper, scissors, lizard, Spock, основываясь на коде, приведенном в уроке.
Дополнительно выполните такие задания:
1. Реализуйте программу таким образом, чтобы пользователь мог повторить игру столько раз, сколько захочет.
Выведите сообщение типа Try again? и варианты ответа:
Yes ([y]) и No ([n]).
2. По завершению игры выведите общий счет и количество побед (Player VS Computer) вот код:
import random
print("")
print("Rock, paper, scissors")
print("Welcome to the game!")
print("The game consists of three rounds.")
print("The winner is the one who scores more points.")
print("\t[r] - rock\n\t[p] - paper\n\t[s] - scissors\n\t[o] - spock\n\t[l] - lizard")
player_score = 0
player_select = 0
comp_score = 0
comp_select = 0
print("")
print("START GAME")
for i in range(3):
print("\tROUND №" + str(i + 1) + "--")
comp_select = random.choice("rps")
while True:
player_select = input("\tYour choice:")
if (player_select == "r") or\
(player_select == "s") or\
(player_select == "l") or\
(player_select == "o") or\
(player_select == "p"):
break
else:
print("\tError")
print("\tComputer:" + comp_select)

if player_select == comp_select:
print("\tDraw!")
elif player_select == "r" and comp_select == "s":
player_score = player_score + 1
print("\You win!")
elif player_select == "r" and comp_select == "p":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "p" and comp_select == "r":
player_score = player_score + 1
print("\tYou win!")
elif player_select == "p" and comp_select == "s":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "s" and comp_select == "p":
player_score = player_score + 1
print("\tYou win!")
elif player_select == "s" and comp_select == "r":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "r" and comp_select == "l":
player_score = player_score + 1
print("\tYou win!")
elif player_select == "s" and comp_select == "o":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "o" and comp_select == "r":
player_score = player_score + 1
print("\tYou win!")
elif player_select == "o" and comp_select == "l":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "l" and comp_select == "o":
player_score = player_score + 1
print("\tYou win!")
elif player_select == "l" and comp_select == "r":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "o" and comp_select == "r":
player_score = player_score + 1
print("\tYou win!")
elif player_select == "r" and comp_select == "o":
comp_score = comp_score + 1
print("\tThe computer wins!")
elif player_select == "p" and comp_select == "l":
comp_score = comp_score + 1
print("\tThe computer wins!")

print("")
print("Game Result")
if player_score > comp_score:
print("Congratulations! You win!")
elif player_score < comp_score:
print("Sorry... The computer wins!")
else:
print("Draw!")
доделайте поже код на питоне

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
milankagl
25.10.2022 18:39

Удачного вам дня

Има́м — в исламе: предводитель молитвы и духовное лицо, которое заведует мечетью; титул, который носят наиболее выдающиеся богословы и религиозные авторитеты; ду­хов­ный и свет­ский гла­ва все­го му­сульманского со­об­ще­ст­ва

Му́фтий — высшее духовное лицо у мусульман. Наделён правом выносить решения по религиозно-юридическим во давать разъяснения по применению шариата. Его решение основывается на религиозно-юридических канонах рас в данной стране направления ислама, а также школы шариата

Мусульмане столицы России открыли исламский центр "Дар

l

0,0(0 оценок)
Ответ:
astahovanadezh
25.03.2023 19:27
На сегодняшний день в условиях развития государства в целом и его отдельных территориальных образований особое значение приобретает формирование социально-экономических процессов. В основе проведенного в статье теоретического исследования структуры социально-экономических процессов заложен целостно-деятельностный подход. В заключение автор делает вывод, что Россия по темпам экономического развития на сегодняшний день демонстрируют отставание от развитых стран, и социально-экономический процесс нуждается в коррекции пропорций. С этой целью необходимо повысить роль образования, создать инновационную инфраструктуру, рынок инноваций и т.д.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота