[Tutor] (no subject)

Andreas Perstinger andreas.perstinger at gmx.net
Fri Nov 11 23:17:15 CET 2011


Please just post plain-text (no html) and use a meaningful subject!

On 2011-11-11 22:40, Nic Jaworski wrote:
> def calc(days):
>   n=0
>   d=1
>   while n>days:
>     n+1
>     d**(n)
>     d*2

You are just calculating some expressions with "n" and "d" but you don't 
assign the results. Thus "n" and "d" will never change.

>     x = array ([d,n])
>     print x

In "main()" you have the line

salary = calc(days)

but you just return "None" (the default value for functions without a 
"return" statement) from "calc()". Is that what you want?

> main()

I don't know about windows but if you want to run the script from the 
command line you have to add:

if __name__ == "__main__":
    main()

See 
http://docs.python.org/py3k/tutorial/modules.html#executing-modules-as-scripts

Bye, Andreas


More information about the Tutor mailing list