Guys what is the probleme this the lesson of pull the trigger after the while loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys what is the probleme this the lesson of pull the trigger after the while loop

X=100 if("hit"): X+=10 else: X-=20 if("hit"): X+=10 else: X-=20 if("hit"): X+=10 else: X-=20 if("hit"): X+=10 else: X-=20 print(X)

9th Aug 2021, 6:10 AM
Ryad Âhméd
6 Answers
0
Ryad Âhméd you didn't even put a do while loop. I doubt that python even have one(correct me if I'm wrong). so use while loop. are you trying to become a yandere?
9th Aug 2021, 6:16 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
Hi Ryad! We recommend you to read what is written at the end of this practice.(yellow box) Use a while loop to take input during each iteration and calculate the points. Additionally, when you have an input and you want to compare it with other variables, you have to use "==" operator. For example, shot = input() if shot == "hit"...so and on Please recall the required lessons to complete this practice.
9th Aug 2021, 8:24 AM
Python Learner
Python Learner - avatar
0
JUMP_LINK__&&__Python__&&__JUMP_LINK Learner hit=10 miss=-20 X=100 while X>=0: shot = input() if shot==hit: X+=10 elif shot==miss : X-=20 print(X) Now what?
9th Aug 2021, 8:22 PM
Ryad Âhméd
0
There are three things noted in your program. 1. You're missing to add a proper terminator to run the loop. Usually, terminators are used for checking while loop conditions. In order to make a terminator you need to declare another variable i(or whatever you want) to run the loop by increasing or decreasing. 2. Strings are must be quoted with single or double quotes to declare as variables. 3. You should care about indentation when you're using loops or if statements in python. They can't be used in a same level. While If Rest of your code Here it is your working code https://code.sololearn.com/csr5JLHae8hw/?ref=app
10th Aug 2021, 1:48 AM
Python Learner
Python Learner - avatar
0
JUMP_LINK__&&__Python__&&__JUMP_LINK Learner dosent work line 6 EOF error when reading line
10th Aug 2021, 5:45 AM
Ryad Âhméd
0
It works fine for me . I can guess that you used assignment variable inside elif statements. But you have to align it with same vertical line. elif shot=="miss": X-=20 i-= 1
10th Aug 2021, 6:52 AM
Python Learner
Python Learner - avatar