- 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)
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 :)
+ 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.
+ 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)
0
Junier
There is no issue in this code. It's perfectly working.
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.
0
Yes the code is right (I don't get indentation errors or any other sort) but I cannot pass the practice task :(.
0
Junier
Share your code again.
0
Thank you all for your suggestions!
0
Hello am new place can't any help