0

Python Question

In the "Pull the trigger" practice, it asks you to count scores using a while loop, where a hit is worth 10, a miss subtracts 20, and you start at 100 points and receive 3 inputs. Why is this giving me an answer (that is correct) of 80 for an input of hit miss hit (100+10-20+10 = 100) and 50 for an input of miss miss miss (100-20-20-20=40). https://code.sololearn.com/cfS0NlL3HgA4/?ref=app https://code.sololearn.com/cfS0NlL3HgA4/?ref=app

2nd Dec 2022, 7:11 PM
Tyler Willke
Tyler Willke - avatar
5 Answers
+ 2
You can scroll the box that shows the inputs in the test section ā€“ this way you can see that there are 4 inputs as in the task description
2nd Dec 2022, 8:44 PM
Lisa
Lisa - avatar
+ 1
Hello i think we need to pay attention to the fact that this loop will receive 4 inputs and not 3 so 100+10-20+10-20 => 80 instead of 100+10-20+10 => 100 as expected so start with x=1 or do while x<3:
2nd Dec 2022, 7:35 PM
Lionel Mallet
Lionel Mallet - avatar
0
I'm fine with that, it actually should receive 4 inputs, I apologize for that. The solution they give you in the practice even includes specifically the x<4 and x=0 starting point, and the questions states it should receive 4 inputs, but when it tests it it only lists 3 inputs
2nd Dec 2022, 7:45 PM
Tyler Willke
Tyler Willke - avatar
0
Ooooh, I'm just dumb, thank you so much Lisa
2nd Dec 2022, 9:16 PM
Tyler Willke
Tyler Willke - avatar
- 1
https://code.sololearn.com/ckKK71h12kU6/?ref=app why line_5 put it in a loop? The person wrote >= the comparison went >= issued a result >= asks to write something again. Not an expert, but how the error went away.
3rd Dec 2022, 9:33 PM
ŠšŠ°Ń€ŠøŠ½Š° ŠšŠ°Ń€ŠæŠ¾Š²Šøч
ŠšŠ°Ń€ŠøŠ½Š° ŠšŠ°Ń€ŠæŠ¾Š²Šøч - avatar