Top.Mail.Ru
Ответы

Помогите с дз пожалуйста

"Задание 1
Поработайте над игрой «Камень, ножницы, бумага», которая
была разработана на уроке, выделив победителя серии игр
(того, кто первым наберет три балла).
Тогда же спросите у игрока о его желании сыграть еще раз.
При утвердительном ответе серия игр должна начаться
сначала.
Задание 2
Улучшите игру, разработанную на уроке до версии «Камень,
ножницы, бумага, ящерица, Спок»"
если что вот код который мы делали на уроке
import random
def game(choice, result):
print("")
print("=====Start Game rock, paper,scissors=====")
computer_choice = random.choice("rps")
print("--------------------------------")
print("Your select – ",str.capitalize(choice))#capitalaze превращает капс в норм текст
print("Computer select —",str.capitalize(computer_choice))
if str.lower(choice) == computer_choice:
print("Result of game – Draw")
print("Score,Computer", result["computer"], "—", result["player"],"Player")
elif str.lower(choice) == "r" and computer_choice == "p":
result["computer"] += 1
print("------Computer Wins------")
print("Score,Computer", result["computer"], "—", result["player"],"Player")
elif str.lower(choice) == "r" and computer_choice == "s":
result["player"] += 1
print("------Player Wins------")
print("Score,Computer", result["computer"], "—", result["player"],"Player")
elif str.lower(choice) == "p" and computer_choice == "s":
result["computer"] += 1
print("------Computer Wins------")
print("Score,Computer", result["computer"], "—", result["player"],"Player")
elif str.lower(choice) == "p" and computer_choice == "r":
result["player"] += 1
print("------Player Wins------")
print("Score,Computer", result["computer"], "—", result["player"],"Player")
elif str.lower(choice) == "s" and computer_choice == "r":
result["computer"] += 1
print("------Computer Wins------")
print("Score,Computer", result["computer"], "—", result["player"],"Player")
elif str.lower(choice) == "s" and computer_choice == "p":
result["player"] += 1
print("------Player Wins------")
print("Score,Computer", result["computer"], "—", result["player"],"Player")

result = {"computer": 0, "player": 0}
choise = input("Select R/P/S – ")
game(choise,result)

По дате
По рейтингу
Аватар пользователя
Ученик

Чо