Help on a summative formula

Emile van Sebille emile at fenx.com
Tue Jan 1 12:55:58 EST 2002


"Ahimsa Consulting" <ahimsa at inext.co.za> wrote in message
news:mailman.1009888201.18587.python-list at python.org...
> Hi all
> Need newbie level assistance on putting together a formula. I am trying to
> work out the phrasing for reading user input and adding each input to the
> previous input until the total is >= 150. I thought for a while the
> Fibonacci series might help since that passes the value of one element and
> adds it to a previous value, so it worked fine for the first two inputs
but
> then went off at a tangent.
> Any thoughts please.
> Thanks
> Andrew
>
>

total = 0
while total < 150:
    total += raw_input("Enter a number: ")

HTH,

--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list