print \ """ If a pregnant hippo, weighing 2,000 pounds, gives birth to a 100 pound calf, but then eats 50 pounds of food, how much does she weigh?""" raw_input("Press the enter key to find out.") print "2000 - 100 + 50 = ", print 2000 - 100 + 50 print \ """ If an adventurer returns from a successful quest and buys each of 6 companions 3 bottles of ale, how many bottles does the adventurer buy?""" raw_input("Press the enter key to find out.") print "6 * 3 = ", print 6 * 3 print \ """ If a kid has 24 pieces of Halloween candy and eats 6 pieces a day, how many days will the stash last?""" raw_input("Press the enter key to find out.") print "24 / 6 = ", print 24 / 6 print \ """ If a group of 4 pirates finds a chest full of 107 gold coins, and they divide the booty evenly, how many coins will be left over?""" raw_input("Press the enter key to find out.") print "107 % 4 = ", print 107 % 4 print \ """ If a restaurant check comes to 19 dollars with tip, and you and your friends split it evenly 4 ways, how much do you each throw in?""" raw_input("Press the enter key to find out.") print "19 / 4 = ", print 19 / 4 print "WRONG!" raw_input("Press the enter key for the right answer.") print 19.0 / 4 raw_input("\n\nPress the enter key to exit.")
Here is a code named "word_problems.py". I can run it on putty.exe, but I don't understand why I cannot run it on IDLE or pyscripter.exe. Both of these two platform show that there are syntax errors in the code, errors are on those red lines. Thanks! ############################## Never had, never will.
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor