Thread: I need help!!!!
View Single Post
  #2 (permalink)  
Old 10-15-2007, 05:57 PM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,651
Last Blog:
CherryPy(thon)
Rep Power: 29
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

First of all; the indents aren't showing, because you're not using the code-tags. Use them in your further posts.

There is four major problems in the code you posted.
1. input() is used for integers, and such, while raw_input() is used for text-input. Just think of it like: input() for numbers and raw_input() for strings.
2. Instead of using the compare-operator, ==, you're using the assignment operator, =. There's a big difference between these operators.
3. When your tries to compare in most of your if-statements, you're forgetting the double-quotes. These are necessary, or the interpreter will see them as variables - and you haven't declared those variable - which result in: error(s)
4. Languages like C++ are using curly brackets for statements, and such, while Python is using colons and indents. So, you need a ':' right after all the places where you're using a statement, e.g. if-statements.

Look at this [corrected] code:
Code:
print "Please enter the first name of a family member."
print "The choices are John, Jane, Jim, and scruffle."

text = raw_input()

if text == "John":
    print "Hello, John"
elif text == "Jane":
    print "Hello, Jane"
elif text == "Jim":
    print "Hello, Jim"
elif text == "Scruffle":
    print "RUFF!!"
else:
    print "I don't know you, sorry!"
__________________
05-03-2007 - 11-13-2008
Reply With Quote