Hey guys..
I have been making a random password maker, which makes a password of 8 characters length, but I am encountering a problem.
Here'e the code I used:
import random
list=['a','b','c','d','e','f','g','h','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','!','@','#','$','%','^','&','*']
randlist=''
a=1
def password():
while a<=8:
randlist+=random.choice(list)
a+=1
return
password()
print randlist
print 'Are you satisfied with your password?'
take=raw_input("YES or NO: ")
if take=='YES':
quit
elif take=='NO':
password()
And here's the error I encounter:
Traceback (most recent call last):
File "C:\Documents and Settings\Sravan\My Documents\Sravan\PYTHON\password.py", line 14, in <module>
password()
File "C:\Documents and Settings\Sravan\My Documents\Sravan\PYTHON\password.py", line 9, in password
while a<=8:
UnboundLocalError: local variable 'a' referenced before assignment