[Tutor] (no subject)

Joel Goldstick joel.goldstick at gmail.com
Fri Nov 11 22:54:24 CET 2011


On Fri, Nov 11, 2011 at 4:40 PM, Nic Jaworski <bufsabres2007 at hotmail.com>wrote:

>  python: v. 2.7.1
> Compiler: WING IDE
> OS: Windows 7
>
> I am attempting to use a loop to output a 2D array for days and amount of
> pennies.  I have it set to loop to do a penny times the day then to double
> the the penny and add a day. (the whole a penny doubles each day
> problem). However when I run my program I don't get anything, no output.
>
> #Nic  11/5/2011
> #Penny +=1 Each Day
>
> from math import *
> from numberTest import *
> from clearPause import *
> from locale import *
> #=============================================Main
>
>
> def main():
>     days=indays()
>     salary = calc(days)
>
> #=========================== Days input
> def indays():
>     integer=0
>     while integer==0:
>         salary = raw_input("how many days for your salary? ")
>         integer,salary=testinteger(salary)
>         if integer ==0:
>             print 'the entry was not numeric - Please re-enter'
>             pause()
>         elif salary < 0:
>             print 'please enter a number greater then 0'
>             integer =0
>         else:
>             integer=1
>     return salary
>
> #=================================Calculation
>
> def calc(days):
>


You are setting n = 0, then you loop only if n > days, and it never is.




>     n=0
>     d=1
>     while n>days:
>         n+1
>         d**(n)
>         d*2
>         x = array ([d,n])
>         print x
>
>
> main()
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111111/f1b6f4fd/attachment.html>


More information about the Tutor mailing list