Hello, I'm going through Python Programming for the Absolute Beginner, 3rd edition, on a Mac with Python 3.2.
In the second chapter, the book gives sample code that shows how a logical error can occur: # Trust Fund Buddy - Bad # Demonstrates a logical error print( """ Trust Fund Buddy Totals your monthly spending so that your trust fund doesn't run out (and you're forced to get a real job). Please enter the requested, monthly costs. Since you're rich, ignore pennies and use only dollar amounts. """ ) car = input("Lamborghini Tune-Ups: ") rent = input("Manhattan Apartment: ") jet = input("Private Jet Rental: ") gifts = input("Gifts: ") food = input("Dining Out: ") staff = input("Staff (butlers, chef, driver, assistant): ") guru = input("Personal Guru and Coach: ") games = input("Computer Games: ") total = car + rent + jet + gifts + food + staff + guru + games print("\nGrand Total:", total) input("\n\nPress the enter key to exit.") This program should show the inputted numbers as a concatenation rather than a sum, I understand that is the mistake in the code. However, when I run it, it shows: Grand Total: 111Manhattan Apartment: 111Private Jet Rental: 111Gifts: 111Dining Out: 111Staff (butlers, chef, driver, assistant): 111Personal Guru and Coach: 111Computer Games: 111 It appears to be adding the input prompt as part of the variables? except for car? What am I missing? Thanks, Asif
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor