Помогите решить | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Помогите решить

Вы создаете игру! Игрок пытается выстрелить в объект и может попасть (hit) или промахнуться (miss) . В начале, игрок имеет 100 очков, попадание прибавляет 10 очков к результату игрока, а промах отнимает 20 очков. Ваша программа должна принять результат 4 действий в качестве входных данных ("hit" or "miss"), затем рассчитать и вывести оставшиеся очки игрока. Пример Входных Данных hit hit miss hit Пример Выходных Данных 110 Мой код ( пишет unexpected ident в строке 4) ______ x = (input()) y = 100 While if x = hit print y + 10 elif x = miss print y - 20

23rd Sep 2021, 5:02 PM
Eugene Motskaitis
Eugene Motskaitis - avatar
3 Answers
+ 3
Cause, you forgot : and == in 4. line. Try this, I changed the errors. x = input() y = 100 While if x == "hit": print(y + 10) elif x == "miss": print(y - 20) It must be work. I hope, it helps. Happy coding!
23rd Sep 2021, 5:29 PM
mesarthim
mesarthim - avatar
+ 1
Eugene Motskaitis I see the problem and I wrote a code for the problem. Also, I added the explanations all lines. Hope, it's clear enough and helps. Happy coding! https://code.sololearn.com/c0aWS7sJIMHa/?ref=app
27th Sep 2021, 8:06 PM
mesarthim
mesarthim - avatar
0
doesn't work((
27th Sep 2021, 7:25 PM
Eugene Motskaitis
Eugene Motskaitis - avatar