0

Pull the Trigger

#I’m having issues with input / output with iteration included .. I know there’s important things missing. Think I will understand iterations better once this is answered. #input should be “hit or miss” to add +10 or -20 to the player_total with 4 attempts player_total = 100 attempts = 0 limited_attempts = 5 shot = input() while attempts < limited_attempts : attempts +=1 if shot == : player_total += 10 print("hit") else: print("miss")

6th Feb 2021, 1:42 AM
Davon
Davon - avatar
2 Antworten
+ 3
Hi Davon Caldwell , 1)first thing move shot into the while loop 2) makes attempts one and then the loop will run 4 times as by starting at zero it will increase attemlts by 1 five times instead of 4 3) also the if statement needs fixing
6th Feb 2021, 1:48 AM
Ollie Q
Ollie Q - avatar
+ 2
points = 100 action = 4 while action > 0: result = input() if result == "hit": points+=10 action-=1 elif result == "miss": points-=20 action-=1 print(points)
29th Jun 2021, 4:46 PM
Sahil
Sahil - avatar