LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Using letters/strings to assign variables in python (https://www.linuxquestions.org/questions/programming-9/using-letters-strings-to-assign-variables-in-python-6555/)

Colonel Panic 09-14-2001 10:13 PM

Using letters/strings to assign variables in python
 
I am working on a little project, a dictionary, and I'm using python to do it. I'd like to assign variables to every word (lots of elif statements in there:D ), but whenever I try to assign a variable with a letter/string, I get an error. Example:

word = input("Word to look up --> ")
if word = "foo":
print "A jargonish term used to define anything unknown. Example: I don't know who made Eric's printer. It's a foocorp. Foo being the unknown"
else:
print "Word not yet added..."

#(The defination is something that I said, not the truth)

You can tell that I'm a novice coder, BUT I'm learning, so go easy on me, and don't flame it, or I'll give you a swift kick in the shin, so nyah!

Anyway, that's where the error would come in. Maybe it has trouble with the "foo" part of it; I really don't know. Thanks in advance!

*****Colonel Panic*****


All times are GMT -5. The time now is 02:07 PM.