[Tutor] SyntaxError while defining tuple : Guidance requested
by John Joseph other posts by this author
Dec 31 2005 12:10AM messages near this date
Re: [Tutor] Numeric RandomArray seed problem.
|
Re: [Tutor] SyntaxError while defining tuple : Guidance requested
Hi
I am trying out learning python , using the book
Â?Python Programming for the absolute beginner Â? by
Michael Dawson
I get
File "page114.py", line 12
inventory = ("Sword","Armor","Shield","Healing
Potion")
^
SyntaxError: invalid syntax
when I run the program which I copied from the text ,
tried a lot to find the reason , I thought of sending
it to the list , so that I get feed back on where I
had gone worng
**********************************************************
inventory()
# treat the tuple as condition
if not inventory:
print "U are empty Handed."
raw_input("\nPress the enter key to continue."
#Create a tuple with some items
inventory = ("Sword","Armor","Shield","Healing
Potion")
#print the tuple
print "\n The Tuple inventory is: \n", inventory
# print each element in the tuple
print "\nYour Items:"
for item in inventory:
print item,
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
http://uk.security.yahoo.com
_______________________________________________
Tutor maillist - Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
John Joseph
Brian van den Broek
Alan Gauld
John Joseph
|