pull the trigger practice in python i'm confused about this code can anyone explain me with the answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

pull the trigger practice in python i'm confused about this code can anyone explain me with the answer

23rd Jul 2021, 1:39 PM
Guna Dhivya Varshini V
Guna Dhivya Varshini V - avatar
4 Answers
+ 2
Thank you so much
23rd Jul 2021, 1:58 PM
Guna Dhivya Varshini V
Guna Dhivya Varshini V - avatar
+ 2
As a future reference, please use proper tags format 👍 https://code.sololearn.com/W3uiji9X28C1/?ref=app
23rd Jul 2021, 3:41 PM
Ipang
+ 1
You didn't post the code so that makes it hard to explain without being able to see it.
23rd Jul 2021, 1:50 PM
Jakko Jak
Jakko Jak - avatar
+ 1
Guna Dhivya Varshini V It is so simple. Just initialise a variable with value 100 and using loop just compare input value with given string like "hit" or "miss". If input value is equal to "hit" then add 10 in declared variable and if input value is equal to "miss" then subtract 20 from declared variable. Since there are only 4 inputs so use while loop like this: j = 0 while j < 4: #take input here # compare this input with hit or miss # add 10 or subtract 20 based on condition from declared variable j += 1 #finally print declared variable
23rd Jul 2021, 1:54 PM
A͢J
A͢J - avatar