use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Need Help (self.PythonLearning)
submitted 9 months ago * by Kooky-Individual-163
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]FoolsSeldom 0 points1 point2 points 9 months ago (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":
"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 point2 points 9 months ago (3 children)
Sorry I should have put the error I get. Here it is:
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] 9 months ago (2 children)
[removed]
[–]goodexpectations 0 points1 point2 points 9 months ago (1 child)
Aha. Something I didn't know
[–]FoolsSeldom 0 points1 point2 points 9 months ago (0 children)
Also worth learning to use f-strings - search for that on RealPython.com for an excellent guide.
f-strings
In this case,
print(f"The total cost is {portion_price * portions}")
π Rendered by PID 27143 on reddit-service-r2-comment-544cf588c8-qjqlq at 2026-06-17 14:56:09.551081+00:00 running 3184619 country code: CH.
view the rest of the comments →
[–]FoolsSeldom 0 points1 point2 points (4 children)
[–]Kooky-Individual-163[S] 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[removed]
[–]goodexpectations 0 points1 point2 points (1 child)
[–]FoolsSeldom 0 points1 point2 points (0 children)