On 19-Jul-11 20:39, Alexander Quest wrote:
Hello; I'm a new student of Python using "Python Programming for Absolute Beginners" 3rd edition by Michael Dawson as my guide. This is a basic question regarding spaces. I'm not sure how to make it so spaces do not show up between variables and basic strings, particularly before commas and after dollar signs, as in the simple "tipper" program I have below.
You don't want to use print with a comma-separated list of values, then. Your best bet would be the format string method, like this:
print """ Okay, based on that bill, a 15% tip would be ${0}, and a 20% tip would be ${1}. """.format(percent15, percent20) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor