0
PULL THE TRIGGER . . . WHILE LOOP - PYTHON FOR BEGINNERS
I completely understand this concept, but this one really got me. We are only suppose to get one output of the total, but I keep getting 4 outputs . . .SOS ='( My code below: points=100 x=1 while x<5: my_input=input() if my_input=="hit": points +=10 elif my_input=="miss": points -=20 x=x+1 print(points) !!!!!!!!!!!!!!!MY CORRECT CODE IS IN THE ANSWER SECTION BELOW!!!!!!!!!!!!!!
3 Answers
+ 8
because your last 'print' is inside the 'while' loop: try to unindent it, and tell us if your code still have problem to pass the tests ;)
+ 6
OMFG - I've been wrecking my brain and pulling my hair out for two days straight trying to figure WTF I WAS DOING WRONG đ
THANK YOU SO MUCH !!!!!!!
Correct code with the help of @visph
points=100
x=1
while x<5:
my_input=input()
if my_input=="hit":
points +=10
elif my_input=="miss":
points -=20
x=x+1
print(points)
0
could you explain to help me better understand your code?