Analysis Number Design Flow chart

Number analysis program design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: the lowest number in the array,the highest number in the array and the total of the numbers in the array...

Questions by pokhara

Showing Answers 1 - 1 of 1 Answers

Michael Brown

  • Apr 1st, 2014
 

Code
  1. numlist = [-7,1,2,45289, 7,5,9,7,4,-10,34,234345678,32,12,1566,0,8,5,4,2]

  2.  

  3.  

  4.  

  5.  

  6. sum = 0

  7. current = numlist[0]

  8. high = numlist[0]

  9. low = numlist[0]

  10. current = numlist[0]

  11.  

  12. for i in range(len(numlist)):

  13.     current = numlist[i]

  14.     if (current >= high ) and (current > low):

  15.         high = current

  16.     elif (current < high) and (current <= low):

  17.         low = current

  18.        

  19.     sum = sum + numlist[i]

  20.    

  21.    

  22.    

  23. print "%s : %d" % ("high" , high)

  24. print "%s : %d" % ("low" , low)

  25. print "%s : %d" % ("sum" , sum)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions