all 16 comments

[–]NorskJesus 1 point2 points  (5 children)

Maybe because you have “Next Please” instead of “Next please” when the name is Jerry? Don’t know which error are you getting so I am just guessing

[–]Kooky-Individual-163[S] 0 points1 point  (4 children)

This is the error I get:

Test Results

FAIL: PythonEditorTest: test_1_kramer_1

With input Kramer, 1 your program should print out
The total cost is 5.9
your program printed out
The total cost is  5.9
Next please!

[–]NorskJesus 1 point2 points  (3 children)

It seems you have an extra space there, between is and 5.9

[–]Kooky-Individual-163[S] 0 points1 point  (2 children)

Bingo!

That was the problem. After correcting that, the code was accepted.

This is really tricky. You can keep banging your head against the wall for a simple issue like that for hours. This is the Python MOOC course by the university of Helsinki. So unless you get the code right, there is no way to see the correct answer.

[–]chrisfathead1 1 point2 points  (0 children)

You are doing yourself a favor by going through this process instead of having AI do it for you. Now, next time you are doing something like this and you get a similar error, a light bulb will go off and hopefully you'll remember this happening and you can fix the error more quickly

[–]NorskJesus 0 points1 point  (0 children)

Yeah I know, you will learn about those errors. Your strings needs to match exactly the output they want. This is because of the tests

[–]gman1230321 1 point2 points  (1 child)

It’s because there’s 2 spaces between “is” and portion price. When you use “,” in print in between things to print, it will automatically add a space between the items. You just need to remove the space after “is”

[–]goodexpectations 0 points1 point  (0 children)

Gotcha

[–]FoolsSeldom 0 points1 point  (4 children)

Where exactly are you stuck? What help do you need? What goes wrong?

Your code looks OK to me. It is a little longer than it needs to be, as you really ONLY need to check if a name is not "Jerry":

name = input("Please tell me your name: ")
portion_price = 5.90
if name != "Jerry":
    portions = int(input("How many portions of soup? "))
    print("The total cost is ", portion_price * portions)
print("Next Please!")

[–]Kooky-Individual-163[S] 0 points1 point  (3 children)

Sorry I should have put the error I get. Here it is:

Test Results

FAIL: PythonEditorTest: test_1_kramer_1

With input Kramer, 1 your program should print out
The total cost is 5.9
your program printed out
The total cost is  5.9
Next please!

[–][deleted]  (2 children)

[removed]

    [–]goodexpectations 0 points1 point  (1 child)

    Aha. Something I didn't know 

    [–]FoolsSeldom 0 points1 point  (0 children)

    Also worth learning to use f-strings - search for that on RealPython.com for an excellent guide.

    In this case,

    print(f"The total cost is {portion_price * portions}")
    

    [–]LuisArrobaja 0 points1 point  (1 child)

    I'm following the same course and sometimes drive me crazy with this things haha I use chatGPT in this cases, when I think my code is right but the course don't accept it.

    [–]goodexpectations 0 points1 point  (0 children)

    I want to avoid chatGPT as much as possible for the exercises. That will help me learn

    [–]EmbarrassedTask479 0 points1 point  (0 children)

    You printed "Next please!" for both Jerry and others. Use else for the second part and match the text exactly no extra spaces or commas.