Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #99205
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-11-21 05:20 -0800 |
| Message-ID | <a76b1b5b-4321-41bb-aeca-0dac787752d9@googlegroups.com> (permalink) |
| Subject | *= operator |
| From | Cai Gengyang <gengyangcai@gmail.com> |
This is a piece of code that calculates tax and tip :
def tax(bill):
"""Adds 8% tax to a restaurant bill."""
bill *= 1.08
print "With tax: %f" % bill
return bill
def tip(bill):
"""Adds 15% tip to a restaurant bill."""
bill *= 1.15
print "With tip: %f" % bill
return bill
meal_cost = 100
meal_with_tax = tax(meal_cost)
meal_with_tip = tip(meal_with_tax)
Does bill *= 1.08 mean bill = bill * 1.15 ?
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
*= operator Cai Gengyang <gengyangcai@gmail.com> - 2015-11-21 05:20 -0800
Re: *= operator BartC <bc@freeuk.com> - 2015-11-21 13:37 +0000
Re: *= operator Steven D'Aprano <steve@pearwood.info> - 2015-11-22 00:39 +1100
Re: *= operator Joel Goldstick <joel.goldstick@gmail.com> - 2015-11-21 08:58 -0500
Re: *= operator "Frank Millman" <frank@chagford.com> - 2015-11-21 15:46 +0200
Re: *= operator Cai Gengyang <gengyangcai@gmail.com> - 2015-11-21 05:55 -0800
csiph-web