Question:
Prompt user to enter ten two digit number. The program should compute the sum of all positive values and print the sum of values added.
Over here what I had done is:
Chosen list to store initial all the ten numbers.
First I have to initialize the list with random numbers and then change them through user prompt.
I believe that I am doing it in wrong way. I would like to know the best possible way to use list for the given problem and matter of fact even would like to get opinion how to use list or what structure to use in place of C arrays.
The code is:
a=[]
for i in range ( 10 ):
(tab)a.append ( [] )
count = sum = 0
print 'Enter the 10 digits: '
for i in range ( 10 ):
(tab)a = int ( raw_input ( ) )
(tab)if a >= 0 and sum < 999:
(2tab)sum = sum + a
(2tab)count += 1
print 'The sum is', sum
print 'Total number: ', count