0

Python for beginners 23.3 hit or miss

This is my code: tries=4 score=100 while tries > 0: action=input() if action=="hit": score+=10 if action=="miss": score-=20 tries-=1 print(score) It keeps saying ~“EOF reading the line” on line 4. Pls help :c

5th Dec 2021, 1:12 PM
Parham M
7 ответов
+ 3
Can you please share the description of this task?
5th Dec 2021, 1:47 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
It looks like you need to take 4 inputs at the beginning of your while loop. If you are familiar with lists just put them into a list. Otherwise you need to create 4 variables and check each of them.
5th Dec 2021, 1:56 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Hello Parham M On sololearn you need to enter all input values at the beginning. Your while loop runs 4 times so you need to enter 4 times hit/miss in this form: hit hit miss hit Then press run.
5th Dec 2021, 1:25 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
I can’t input the strings myself, the system does it. Should I take the input function out of the while loop?
5th Dec 2021, 1:40 PM
Parham M
+ 1
You are making a game! The player tries to shoot an object and can either hit or miss it. The player starts with 100 points, with a hit adding 10 points to the player’s score, and a miss deducting 20 points. Your program needs to take 4 action results as input ("hit" or "miss"), calculate and output the player’s remaining points.
5th Dec 2021, 1:49 PM
Parham M
+ 1
I haven’t learned lists yet. I guess I should study further before attempting this challenge. Thank you for your help.
5th Dec 2021, 1:58 PM
Parham M
+ 1
Parham M Program is running successfully no issue.
5th Dec 2021, 2:02 PM
A͢J
A͢J - avatar