Hi all Pythons!
I'm new to Python and this List!
I'm reading Hetland's "Beginning Python" and I tried to test myself
an example the book provides in 59:
width = input('Please enter width: ')
price_width = 10
item_width = width - price_width
header_format = '%-*s%*s'
format = '%-*s%*.2d'
print '=' * width
print haeder_format % (item_width, 'Item', price_width, 'Price')
print '-' * width
print format % (item_width, 'Apples', price_width, 0.4)
print format % (item_width, 'Pears', price_width, 0.5)
print format % (item_width, 'Cantaloupes', price_width, 1.92)
print format % (item_width, 'Dried Apricots (16 gr)' price_width, 8)
print format % (item_width, 'Prunes (4 Kgr)', price_width, 12)
print '=' * width
Trying to run this script (saved as "test.py")I receive this error message:
a...@deadend:~/Desktop$ python test.py
File "test.py", line 18
print format % (item_width, 'Dried Apricots (16 gr)' price_width, 8)
^
SyntaxError: invalid syntax
I double checked my typing and I see no errors in it (I copied it from
the book exactly as it is)! Are there any...? What's the "invalid"
in my "syntax"?
Thanx for the help!
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor