print "Welcome to Philipp's lemonade stand" print " We have two drinks, (large - $1.15 and small 53 cents), How many large do you want?" large_drink_number = input () print "How many small drinks?" small_drink_number = input () print "Please give me money" money_paid = input () total_owed = (large_drink_number * 1.15) + (small_drink_number * .53) print total_owed if money_paid < total_owed: print "GIVE ME MORE MONEY!!!" exit (1) else: change = money_paid - total_owed print "Here are your (%d) large drinks and (%d) small drinks. I need to return to you $ (%.2f)" % (large_drink_number, small_drink_number, change) print "I will return to you:" cents = change - int(change) print int(change), "dollars", cents = cents * 100 if cents >= 25: number_quarters = cents // 25 cents = cents % 25 print " %d quarters" % (number_quarters), if cents >= 10: number_dimes = cents // 10 cents = cents % 10 print " %d dimes" % (number_dimes), if cents >= 5: number_nickels = cents // 5 cents = cents % 5 print "%d nickels" % (number_nickels), if cents >= 1: print "%d cents" % (cents)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question