- 1

Python for beginners Pull The Trigger Pro

The code works: I dont receive any errors and I get the right results. But still something is wrong maybe with the syntax because I cannot pass the Practice 25.2. Thank you in advance for your help! Cheers everybody! StartPoints = int(100) EndScore = StartPoints shoots = 0 while shoots < 4: UserImput = input() # user shoots if UserImput == "hit": # I forgot the "" on hit EndScore += 10 # this will add 10 elif UserImput == "miss": EndScore -= 20 # this will deducts 20 shoots += 1 # add 1 to shoots print(EndScore)

24th Jun 2021, 4:19 PM
Junier
9 Antworten
0
:) :) I did a trick! and now it works! Here is the solution: I copy the code from this post and paste it in the IDE from SoloLearn and voilà. I guess SoloLearn IDE is a WIP :)
24th Jun 2021, 5:53 PM
Junier
+ 3
I think your code is absolutely right though I cannot become so sure if you don't give an explanation of that code coach. Try again to copy the code and paste the code. Be careful while pasting your code in code coach because if your code gets unnecessary indentation, your code may get an indentation error.
24th Jun 2021, 4:33 PM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Hi everyone , my code works, you can use it . This is related to Python for Beginners - 25.2 Practice points = 100 i = 1 while i <= 4: x = input() if x == "hit": points +=10 elif x == "miss": points -=20 i = i+1 print(points)
13th Jul 2021, 11:07 AM
Amir Hossein
Amir Hossein - avatar
0
Junier There is no issue in this code. It's perfectly working.
24th Jun 2021, 5:00 PM
A͢J
A͢J - avatar
0
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.
24th Jun 2021, 5:43 PM
Junier
0
Yes the code is right (I don't get indentation errors or any other sort) but I cannot pass the practice task :(.
24th Jun 2021, 5:44 PM
Junier
0
Junier Share your code again.
24th Jun 2021, 5:49 PM
A͢J
A͢J - avatar
0
Thank you all for your suggestions!
24th Jun 2021, 5:55 PM
Junier
0
Hello am new place can't any help
25th Jun 2021, 11:00 PM
anas khhalil