User Profile

Collapse

Profile Sidebar

Collapse
PythonB15
PythonB15
Last Activity: Jun 19 '15, 01:47 PM
Joined: May 19 '15
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • dwblas, you said calculate it for each item, how would you actually do this in python?

    computerfox, thanks for the solution is this the most effective way to get an average in Python?
    See more | Go to post

    Leave a comment:


  • PythonB15
    replied to Ways of Sorting 2D lists in Python
    Apologies if I ask the basic of questions as I am new to python.

    How would you manually iterate through a list of lists? I would like to know any other built in functions/loops that would do the same thing as BVDET has shown. I'm just curious and want to learn that's all.
    See more | Go to post

    Leave a comment:


  • PythonB15
    started a topic working out the average within a nested list

    working out the average within a nested list

    Hi all,

    another question....

    I have a data structure which consists of a game players name and their scores, I have use lists within lists (2D):

    results = [["Ben", 15, 18,25], ["George", 25, 35, 85], ["Evie", 2, 54, 84]]

    What I want to do is work out the average for each player and then sort by the highest average score.

    any idea?

    ...
    See more | Go to post

  • PythonB15
    replied to Ways of Sorting 2D lists in Python
    Does anybody have any other ways of doing this?
    See more | Go to post

    Leave a comment:


  • PythonB15
    replied to Ways of Sorting 2D lists in Python
    Thank you very much, you have been brilliant.
    See more | Go to post

    Leave a comment:


  • PythonB15
    replied to Ways of Sorting 2D lists in Python
    Yes kind of, but I want to display all the players results, starting with their highest....

    Also can you explain briefly what the code does:

    for i, item in enumerate(resul ts):
    results[i] = [item[0], max(item[1:])]

    is "item in enumerate" a default python statement?
    the second line: results[i] = [item[0], max(item[1:])]
    can you please explain this to me?
    See more | Go to post

    Leave a comment:


  • PythonB15
    started a topic Ways of Sorting 2D lists in Python

    Ways of Sorting 2D lists in Python

    Hi all,
    I am hoping you can help me.

    I have a data structure which consists of a game players name and their scores, I have use lists within lists (2D):

    results = [["Ben", 15, 18,25, 6, 9], ["George", 25, 35, 85, 12, 9], ["Evie", 2, 54, 84, 62,18]]

    What I want to do is sort the list in alphabetical order with each players highest score.

    I know how to sort by specifying...
    See more | Go to post
No activity results to display
Show More
Working...