aug dawg <augdaw...@gmail.com> wrote on 08/24/2010 01:55:14 PM:

> Now it says that the variable adder is not defined. Does anyone know 
about this?
> 
It is best if you send the full error message, it helps pinpoint the 
problem.
my copy of your code was:
database = []
datafile = open('/home/~/the-db/data')
for line in datafile:
database.append(line)

while tf2 != True:
command = raw_input("Enter a command. >> ")

while tf != True:
if "add" in command:
adder = raw_input("What to add? >> ")
data_base.append(adder)
if "no more" in adder:
tf = True

if "read" in command:
print(database)
if "search" in command:
searcher = raw_input("Enter term to search >> ")
if searcher in database:
# Figure this out.
if "exit database" in command:
print "Bye!"
sys.exit()

I am not sure what you typed in as your command or how your source was 
formatted (the tabs did not come through to me) so I cannot say for sure.
If "add" was not your command, adder does not get defined. 
My guess is that you typed in a different command so you skipped the 
assignment but are checking for "no more" in adder, or attempting to 
append adder.  This would trigger that error.  Did you get the "What to 
add? >>" message?

Chris
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to