Python Forum
local variable 'l' referenced before assignment...
Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
local variable 'l' referenced before assignment...
#2
Actually, you will get the same error, no matter which letter you enter. The letters (a-z) are defined in prealphabet and are local to that function, which means alphabet is unawares of their existence.  You could  include the contents of prealphabet to the beginning of the alphabet function and that would solve that particular problem.

You might want to start with a smaller version of your script, say 4 or 5 letters, until you get the bugs worked out, then expand it to include all letters
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply


Messages In This Thread
RE: local variable 'l' referenced before assignment... - by sparkz_alot - Jan-21-2017, 02:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Rounding exercise: UnboundLocalError: local variable referenced before assignment Drone4four 5 3,489 Sep-06-2020, 09:01 AM
Last Post: ibreeden
  UnboundLocalError: local variable 'a' referenced before assignment fad3r 3 16,595 Jun-20-2018, 05:43 PM
Last Post: nilamo
  why am I getting "local variable 'x' referenced before assignment"? wlsa 6 9,168 Jun-16-2018, 05:31 PM
Last Post: buran
  variable referenced before assignment Niko047 4 23,012 Aug-04-2017, 07:55 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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