r/PythonLearning • • Oct 15 '26

Help Request I’m stuck on this assignment

I never struggle on assignments but this one is so confusing for me

132 Upvotes

66 comments sorted by

View all comments

4

u/igotshadowbaned Oct 16 '26 edited Oct 19 '26 • Bravo

For print, if you want it to just print text as a string, you need to put it in quotes

print("You earned a bonus")

If you want to also print a variable, you put it in the list within the function call

print("You earned a bonus", str(bonus_1)

You can alternatively combine the strings first

string = "You earned a bonus" + str(bonus_1)
print(string)

But your syntax is currently the problem.

You do do it correctly later. And then also use fstrings.

You're also missing a semi colon after your last elif statement, which is highlighted

Did you try using AI to write this? I'm just confused how else you would have correctly written sections that do the same thing, but then not be able to figure why it isn't working 6 lines above that

2

u/spidertyler2005 Oct 19 '26

Colon* not a semicolon. Just in case they see it before you make an edit

1

u/kyle2143 Oct 21 '26

The second screen says that the code was pre-written above the comment in line 18. I think he legitimately tried to write the code and just got the syntax wrong for prints and string concatenations.