python help

Discussion in 'Python' started by msullivan3, Feb 4, 2010.

  1. msullivan3

    msullivan3 New Member

    Joined:
    Apr 27, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    trying to figure out a simple little function

    Given a variable temps that refers to a list, all of whose elements refer to values of type float , representing temperature data, compute the average temperature and assign it to a variable named avg_temp . Besides temps and avg_temp , you may use two other variables -- k and total .

    i currently have:

    for k in range(len(temps)):
    total += temps[k]

    avg_temp = total / len(temps)

    and I cannot figure out what is going and why this isnt working for me
     
  2. msullivan3

    msullivan3 New Member

    Joined:
    Apr 27, 2009
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    nevermind. never declared certain variables. feel free to delete or close this thread
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice