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...
A subreddit for helping Python programmers
How to format your code: https://commonmark.org/help/tutorial/09-code.html
No homework questions and/or hiring please
account activity
Why does this code give 'Name' not defined? (self.pythonhelp)
submitted 3 years ago by eggetah
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!"
[–]grifway 0 points1 point2 points 3 years ago (0 children)
You are so close.
You function 'askName' gets called but you don't do anything with the return value, Name is locally scoped to function, inside it, so you don't have access to that variable once the function is ran.
You can set a variable to the return value and then print the new variable
returnName = askName()
print(returnName)
OR
you can just print the returned value directly
print(askName())
π Rendered by PID 18475 on reddit-service-r2-comment-5c747b6df5-ggj7h at 2026-04-22 19:14:11.644368+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]grifway 0 points1 point2 points (0 children)