Python Forum
NameError: name 'print_string' is not defined
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NameError: name 'print_string' is not defined
#3
check line 41, do you really want the return statement at that place in the function and with that indentation? what will happen if the else block is executed? print_string has local scope - it exists only inside the function and is not accessible outside it. Do you want lines 43-48 inside the function. If it should be outside - ship_method (local scope inside the function) will not be accessible and will cause NameError
Note that there is a LOT of redundant code...
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: NameError: name 'print_string' is not defined - by buran - Jun-11-2020, 05:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation NameError: name 'score' is not defined - Help? MrKnd94 13 5,258 Mar-06-2023, 10:54 PM
Last Post: deanhystad
  How to correct the NameError: name 'xx' is not defined? vokoyo 5 11,606 Feb-17-2021, 05:55 AM
Last Post: delonbest
  NameError: name 'os' is not defined, & load_files(sys.argv[1]) AryaIC 3 4,936 Nov-07-2020, 07:45 PM
Last Post: jefsummers
  Error in code NameError: name ' ' is not defined ppman00 11 6,743 Sep-18-2020, 05:22 AM
Last Post: ndc85430
  "NameError: name 'catName1' is not defined tofif 3 5,867 Jun-24-2019, 06:05 AM
Last Post: perfringo
  NameError x not defined Bruizeh 5 5,525 Feb-27-2019, 10:59 AM
Last Post: Larz60+
  NameError: name 'mailbox_list' is not defined pythonnewb 2 4,861 Aug-06-2017, 09:31 PM
Last Post: pythonnewb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020