Has anyone stumbled across this problem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Has anyone stumbled across this problem?

You are making a game! The player tries to shoot an object and can 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. Sample Input hit hit miss hit Sample Output 110 Explanation: 3 hits add 30 points, one miss deducts 20, making the total points equal to 110. https://code.sololearn.com/chiE8N12MEOZ/?ref=app https://code.sololearn.com/chiE8N12MEOZ/?ref=app https://code.sololearn.com/W9Z40v60i9iR/?ref=app

21st Mar 2021, 4:50 AM
Suha S
2 Answers
- 1
Python: I =0 H = 100 while True: if I>=4: break x=input() if x == "hit": H +=10 elif x == "miss": H-=20 I+=1 print(H)
21st Mar 2021, 5:15 AM
Илья Мирошник
Илья Мирошник - avatar
- 1
it worked! thanks :)
21st Mar 2021, 5:37 AM
Suha S