[Tutor] Fw: counting number of inputs
MICHELLE EVANS
evans1018 at verizon.net
Wed May 3 17:46:25 CEST 2006
This is what I have so far. Can anyone help?
> number1 = int(raw_input("Run number 1 (-1 to end) : "))
> number2 = int(raw_input("Run number 2 (-1 to end) : "))
> number3 = int(raw_input("Run number 3 (-1 to end) : "))
> number4 = int(raw_input("Run number 4 (-1 to end) : "))
> number5 = int(raw_input("Run number 5 (-1 to end) : "))
>
>
> # The following will sum the numbers and then print the answer
> sum = number1 + number2 + number3 + number4 + number5
> print
> print "The total number of parts produced was:", sum,"."
>
> I need this to ask the user to enter their number per each run. That is why
> I have 5 different input numbers. I need this break if a -1 is entered.
> Would I use "if-else" to break this if -1 is entered? I need to be able to
> count the number of lines entered. I also need to print the run number with the highest and lowest input number.
>
> Thanks, I'm lost
> Rick
>
----- Original Message -----
From: MICHELLE EVANS
To: tutor at python.org
Sent: Tuesday, May 02, 2006 7:25 PM
Subject: counting number of inputs
I am trying to count the number of times a positive number is entered from the user. But, the program must stop after 5 user inputs or a negative number.
Can anyone help.
Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060503/a40a20af/attachment.htm
More information about the Tutor
mailing list