помогите пжпжпжпжппжпжп Зробіть так, щоби під час закінчення гри у користувача запитували, чи хоче він зіграти знову. Якщо відповідь схвальна,
гра має запуститися знову. на мові питон
Підказка: необхідно помістити цикл всередину іншого
циклу.
from turtle import*
from random import randint
shape(\"turtle\")
colors = [\"Blue\",\"Red\",\"Orange\",\"Pink\", \"black\",\"Green\"]
shredder=randint(1,10)
user_choose = 0
while user_choose != shredder:
user_choose = str.lower(input(\"select direction Left/Right/Direct/Back - \"))
if user_choose == str.lower(\"left\"):
left(90)
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
elif user_choose == str.lower(\"right\"):
right(90)
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
elif user_choose == str.lower(\"direct\"):
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
elif user_choose == str.lower(\"back\"):
left(180)
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
if user_choose!= shredder:
print(\"Shredder is not here, let\'s move on\")
print(\"Shredder here!\")
print(\"You didn\'t catch this character and you lost\") це код
гра має запуститися знову. на мові питон
Підказка: необхідно помістити цикл всередину іншого
циклу.
from turtle import*
from random import randint
shape(\"turtle\")
colors = [\"Blue\",\"Red\",\"Orange\",\"Pink\", \"black\",\"Green\"]
shredder=randint(1,10)
user_choose = 0
while user_choose != shredder:
user_choose = str.lower(input(\"select direction Left/Right/Direct/Back - \"))
if user_choose == str.lower(\"left\"):
left(90)
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
elif user_choose == str.lower(\"right\"):
right(90)
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
elif user_choose == str.lower(\"direct\"):
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
elif user_choose == str.lower(\"back\"):
left(180)
for color_turtle in colors:
pensize(randint(1,10))
color(color_turtle)
forward(randint(5,30))
user_choose = randint(1,10)
if user_choose!= shredder:
print(\"Shredder is not here, let\'s move on\")
print(\"Shredder here!\")
print(\"You didn\'t catch this character and you lost\") це код
Ответ
0
(0 оценок)
0
Відповідь:
.
Пояснення: