9/4/22

Pull the trigger

 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.


#your code goes here


a=[]

for i in range(0,4):

   l=input()

   a.append(l)

   

p = 100



for x in a:

    if x == 'hit':

        p += 10

    else:

        p -= 20

        

print (p)

Blog Archive