1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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