0
Python for Beginners 24.3
I can figure out how to get it to stop repeating the first input. Can anyone tell me what I am getting wrong here? shots = input() points = 100 i = 0 while i < 4: if shots == 'hit': points += 10 print(points) elif shots == 'miss': points -= 20 print(points) i += 1
4 odpowiedzi
+ 2
You have to take the input within the loop. Right now you're taking input only once
+ 1
Hi Matt!
Another thing is that you have to print the final points instead of printing each points for every iteration. For that, you can print it outside loop.
Here it is your corrected code.
points = 100
i = 0
while i < 4:
shots = input()
if shots == 'hit':
points += 10
#print(points)
elif shots == 'miss':
points -= 20
#print(points)
i += 1
print(points)
+ 1
Thank you. That makes a lot of sense.
0
Thank you