Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Working with Lists of Athlete Records | Tracking Athlete Performance
Python for Coaches

bookWorking with Lists of Athlete Records

Managing a team of athletes often means keeping track of a lot of data—names, performance metrics, and progress over time. In Python, you can organize this information efficiently by using a list of dictionaries, where each dictionary represents an athlete and their individual stats. This structure makes it easy to store, access, and update each athlete's information, which is especially useful when you need to manage data for an entire team or compare athletes side by side.

1234567891011121314151617181920
athletes = [ { "name": "Jordan Lee", "speed": [7.2, 7.5, 7.3], # Weekly speed in mph "endurance": 85, # Endurance score out of 100 "attendance": 3 }, { "name": "Morgan Cruz", "speed": [6.8, 7.1, 7.0], "endurance": 90, "attendance": 2 }, { "name": "Taylor Kim", "speed": [7.4, 7.6, 7.8], "endurance": 88, "attendance": 3 } ]
copy

By organizing your data this way, you can easily loop through the list to access or update each athlete's record. Iterating through the list allows you to perform actions such as printing all athletes' names, calculating averages, or modifying stats based on new results. This approach is scalable, meaning you can add or remove athletes without changing how you process the list.

123
for athlete in athletes: avg_speed = sum(athlete["speed"]) / len(athlete["speed"]) print(f"{athlete['name']}: Average weekly speed is {avg_speed:.2f} mph")
copy

1. What Python data structure is best for storing multiple athlete records?

2. How can you access the endurance value for the second athlete in the list?

3. What is the benefit of using a loop to process athlete data?

question mark

What Python data structure is best for storing multiple athlete records?

Select the correct answer

question mark

How can you access the endurance value for the second athlete in the list?

Select the correct answer

question mark

What is the benefit of using a loop to process athlete data?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 2

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

bookWorking with Lists of Athlete Records

Veeg om het menu te tonen

Managing a team of athletes often means keeping track of a lot of data—names, performance metrics, and progress over time. In Python, you can organize this information efficiently by using a list of dictionaries, where each dictionary represents an athlete and their individual stats. This structure makes it easy to store, access, and update each athlete's information, which is especially useful when you need to manage data for an entire team or compare athletes side by side.

1234567891011121314151617181920
athletes = [ { "name": "Jordan Lee", "speed": [7.2, 7.5, 7.3], # Weekly speed in mph "endurance": 85, # Endurance score out of 100 "attendance": 3 }, { "name": "Morgan Cruz", "speed": [6.8, 7.1, 7.0], "endurance": 90, "attendance": 2 }, { "name": "Taylor Kim", "speed": [7.4, 7.6, 7.8], "endurance": 88, "attendance": 3 } ]
copy

By organizing your data this way, you can easily loop through the list to access or update each athlete's record. Iterating through the list allows you to perform actions such as printing all athletes' names, calculating averages, or modifying stats based on new results. This approach is scalable, meaning you can add or remove athletes without changing how you process the list.

123
for athlete in athletes: avg_speed = sum(athlete["speed"]) / len(athlete["speed"]) print(f"{athlete['name']}: Average weekly speed is {avg_speed:.2f} mph")
copy

1. What Python data structure is best for storing multiple athlete records?

2. How can you access the endurance value for the second athlete in the list?

3. What is the benefit of using a loop to process athlete data?

question mark

What Python data structure is best for storing multiple athlete records?

Select the correct answer

question mark

How can you access the endurance value for the second athlete in the list?

Select the correct answer

question mark

What is the benefit of using a loop to process athlete data?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 2
some-alt