Hi Nathan,
Please see my comments listed below.
Nathan Pinno wrote:
> 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":
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Nathan Pinno wrote:
> 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 pas
On Tue, 28 Jun 2005 14:39:47 -0400, Nathan Pinno wrote
(in article <[EMAIL PROTECTED]>):
> 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.
>
> #Thi
password = raw_input("Type in the password, please: ")
while password != "hello":
print "Incorrect password!"
Wouldn't this print "Incorrect password" untill the end of time if you
didn't supply the correct password?
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
1) check the spacing before if name == "Nathan":
2) put a ':' after else
Regards,
Philippe
Nathan Pinno wrote:
> 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 cod
Make sure that line with name=="Nathan" is not indented. It's hard to
tell from the code there.
Also, I'm thinking that this won't work:
if name == "Nathan":
print "What a great name!"
elif name == ["Madonna", "Cher"]:
because the variable name is a string and not a list. You could t
Hi,
> 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.
The problem is that you indent the if statement. the if/elif/else
statements
are part of the outer block, so they do not need indentation.
>
On 6/28/05, Nathan Pinno <[EMAIL PROTECTED]> wrote:
> Hi all,
>
[snip!]
It looks like your indentation is off for the if statement. It should
be aligned with the "name = raw_input" statement above it.
Also, elif name == ["Madonna", "Cher"]: will never evaluate to true.
Assume someone enters
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