Super-newbie needs help!

Michal Wallace sabren at manifestation.com
Wed Nov 28 13:02:56 EST 2001


On 28 Nov 2001, SnowCrash wrote:

> "Write a program that continually reads in numbers from the user and
> adds them together until the sum reaches 100. "
> 
> Now, i have some code:
> total = 100
> sum = input ("Enter your number.")
> while sum < total:
> 	print "You haven't reached 100 yet!"
> 	sum = input ("give me another number") + sum
> 
> print "Ok, you got me!"
> 
> HUH? i don't think its right, i've changed it about 4 times before
> posting it, and i've downloaded the Python 2.2 but can't seem to
> figure out how to use the thing to check my code. i know its WILDLY
> simple and feel like "well, gee, if i can't understand this much, then
> i should quit before i feel REALLY stupid", but i am just going to
> keep on truckin'....Hopefully with some help from comp.lang.python.

The code looks about right to me.

Just save it to a text file called something like "sum.py"
and then run: 

   "python sum.py"
 
Or better yet, load it into the IDLE program that came with
python, and hit F5 to run it.


Cheers,

- Michal   http://www.sabren.net/   sabren at manifestation.com 
------------------------------------------------------------
Give your ideas the perfect home: http://www.cornerhost.com/
 cvs - weblogs - php - linux shell - perl/python/cgi - java
------------------------------------------------------------





More information about the Python-list mailing list