I need help figuring out how to fix this code.

Nathan Pinno falcon3166 at hotmail.com
Tue Jun 28 14:39:47 EDT 2005


  Hi all,

  I need help figuring out how to fix my code. I'm using Python 2.2.3, and
it keeps telling me invalid syntax in the if name == "Nathan" line. Here is
the code if you need it.

  #This program asks for a password, then asks for the user's name after the
correct password has been supplied. The computers response will vary,
  # depending on the name inputted.
  print "Program Author: Nathan Pinno"
  print "ID# 2413448"
  print
  print "Program 3 - Loops and IF Conditions"
  print
  password = raw_input("Type in the password, please: ")
  while password != "hello":
      print "Incorrect password!"
  print "Welcome to the second half of the program!"
  name = raw_input("What is your name, please? ")
      if name == "Nathan":
          print "What a great name!"
      elif name == ["Madonna", "Cher"]:
          print "May I have your autograph please!"
      else
          print name,", that's a nice name!"

  What's wrong with the code? How do I fix it, so that it works?

  Thanks,
  Nathan Pinno
  http://www.npinnowebsite.ca/



-- 


----------------------------------------------------------------
     Posted via UsenetRevolution.com - Revolutionary Usenet
** HIGH RETENTION ** Specializing in Large Binaries Downloads **
                 http://www.UsenetRevolution.com



More information about the Python-list mailing list