[Tutor] Function behavior
bob gailer
bgailer at gmail.com
Sat Sep 18 00:10:19 CEST 2010
On 9/16/2010 8:18 AM, Ken Green wrote:
> I am unclear on the behavior of using a function. Below is a short
> code I wrote to print an amount out after inputting the number of match.
>
> # TEST Function.py
>
> def change(amount):
> if match == 1:
> amount = 0
> if match == 2:
> amount = 0
> if match == 3:
> amount = 3
>
[snip]
How about:
def change(amount, amts={1:0, 2:0, 3:3}):
return amts[match]
--
Bob Gailer
919-636-4239
Chapel Hill NC
More information about the Tutor
mailing list