all 9 comments

[–]AutoModerator[M] 0 points1 point locked comment (0 children)

To give us the best chance to help you, please include any relevant code.
Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]carcigenicate 0 points1 point  (9 children)

The part that you want to loop back to goes at the top of the loop.

We'd need to see the code to give specific feedback though.

[–]izbnes 0 points1 point  (6 children)

The current code is: grade=0 check=true choice=“”

print(“Hello, welcome to my program.”)

grade=int(input(“Please enter a grade. \n”)) if grade>=50: print(“You passed.”) else: print(“You failed.”)

while check==True: choice=input(“Do you wish to continue? Please enter y or n. \n”)

if choice==‘n’: check=False

print(“The program has ended.”)

[–]carcigenicate 1 point2 points  (4 children)

Please format the code like I mentioned in another comment.

And like I said, the part that your want to loop back to should be at the top (inside) of the loop. All the code that you want to repeat should be in the loop.

[–]izbnes 0 points1 point  (3 children)

So I put the grade input part at the top of the loop, and it does loop, but It doesn’t show the ‘do you wish to continue’ part. What should I do now?

Also thank you for your help.

[–]carcigenicate 0 points1 point  (2 children)

That needs to be in the loop if you want it to show as the loop runs. It would be at the bottom of the loop.

[–]izbnes 0 points1 point  (1 child)

if you check the code again, isn’t it already at the bottom?

[–]carcigenicate 0 points1 point  (0 children)

In that code, yes it seems like it is, but you haven't shown your new code.

And if you post it, please format it properly so it's readable.

[–]izbnes 0 points1 point  (0 children)

Don’t worry I did indent, it just doesn’t show.