None???
Heather Coppersmith
me at privacy.net
Sat Sep 20 21:17:29 EDT 2003
On Sun, 21 Sep 2003 01:12:04 GMT,
"News" <jakle1 at hotmail.com> wrote:
> I just started using python a few weeks ago. This is my first
> program. You input your income and what percent you want to save
> then it tells you how much to put away. The the code works, but
> it puts in the word "none" after it calls the function. Is the
> call sytax incorrect? I'd appreciate any feedback you could
> offer .
[ ... ]
> weekly_income = income/52
> def compute(income, percent):
> result = income*percent/100
> print result
Note that this function prints its result and then returns None.
> print "Ok,",first_name + " " + last_name
> print
> print "This is how much you should put away a week:"
> print "$",compute(weekly_income, percent)
OTOH, it looks like this print statement expects the function to
return its result.
> print
> print "If you stick to this you will go places!!! :-)"
The simplest (and most general) solution would seem to be to
define the function to return its result:
define compute(income, percent):
result = income * percent / 100
return result
Then the print statement will work as written.
Regards,
Heather
--
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli
More information about the Python-list
mailing list