[Tutor] Function behavior (SOLVED)

Ken Green beachkidken at gmail.com
Sat Sep 18 02:50:35 CEST 2010


Thank you.  This will be printed out and studied.  Amazing of what 
Python can do.

Ken

On 09/17/2010 06:10 PM, bob gailer wrote:
>  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]
>


More information about the Tutor mailing list