arrays in python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Loyisile
    New Member
    • Mar 2010
    • 3

    arrays in python

    read 5 numbers into an array.Display the biggest,smalles t,average and sum of all the numbers, as well as what percentage each number contributes to the sum.
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    And your question is........

    Comment

    • bvdet
      Recognized Expert Specialist
      • Oct 2006
      • 2851

      #3
      Maybe this will help:
      Code:
      >>> mylist = [0,1,2,3,4,5,6,7,8,9]
      >>> min(mylist)
      0
      >>> max(mylist)
      9
      >>> thesum = sum(mylist)
      >>> avg = thesum/float(len(mylist))
      >>> thesum
      45
      >>> avg
      4.5
      >>>

      Comment

      Working...