0
Pls I need help with this question n I want to understand the solution to the question
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. 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.
4 Answers
+ 3
There's a saying that"if you want something to be done well, u would have to do it urself"
I have found the solution to my own problem
total=100
i=1
while i<=4:
x=input()
i+=1
if x=="hit":
total +=10
else :
total -=20
print (total )
the while loop i<=4 allows the code to take only 4 inputs.
so for every input , if x equals hit , 10 is added to" total ".
if x equals miss for every input ,20 is deducted from "total ".
+ 2
Kingsley Ocran You have to take 4 input, hit or miss. Initially given point is 100. Every hit will give you 10 point and every miss will deduct 20 point.
https://code.sololearn.com/cWri9DmD1BTN/?ref=app
+ 1
Please, show your attempt/code and explain your problem is clearly. So, we can help. Thanks for understanding.
Happy coding!
+ 1
Kingsley Ocran Good job!