View Full Version : Really n00bish python question
Gnobody
April 24th, 2005, 02:12 AM
I was reading some Dive into Python for the first time and I was wondering why my simple name/string program doesn't work:
print "Welcome"
print
name = raw_input("Please enter in your name: ")
if name == "Jason" then
print "Hello Jason!"
else
print "Go away!"
sas
April 24th, 2005, 02:45 AM
I was reading some Dive into Python for the first time and I was wondering why my simple name/string program doesn't work:
Your problem is missing ":" after if and else, also next isn't a keyword in python (iirc)
your code should look more like this:
print "Welcome"
print
name = raw_input("Please enter in your name: ")
if name == "Jason":
print "Hello Jason!"
else:
print "Go away!"
Gnobody
April 24th, 2005, 05:46 PM
Your problem is missing ":" after if and else, also next isn't a keyword in python (iirc)
your code should look more like this:
print "Welcome"
print
name = raw_input("Please enter in your name: ")
if name == "Jason":
print "Hello Jason!"
else:
print "Go away!"
Wow, Python and Gedit pwn me. Now to learn PyGTK...
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.