Find the best solutions to your questions at Westonci.ca, the premier Q&A platform with a community of knowledgeable experts. Get immediate answers to your questions from a wide network of experienced professionals on our Q&A platform. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform.
Sagot :
Answer:
quarterback_stats = {
'Aaron Rodgers': {'COMP': 371, 'YDS': 4925, 'TD': 39, 'INT': 8},
'Peyton Manning': {'COMP': 400, 'YDS': 4659, 'TD': 37, 'INT': 11},
'Greg McElroy': {'COMP': 19, 'YDS': 214, 'TD': 1, 'INT': 1},
'Matt Leinart': {'COMP': 16, 'YDS': 115, 'TD': 0, 'INT': 1}
}
print("2012 quaterback statistics: ")
print("Passes completed: ")
for qb in quaterback_stats.keys():
print(f"{quaterback_stats[qb]} : {quaterback_stats[qb]['COMP']}")
print("Passing yards:")
for qb in quaterback_stats.keys():
print(f"{quaterback_stats[qb]} : {quaterback_stats[qb]['YDS']}")
print("Touchdown / interception ratio")
for qb in quaterback_stats.keys():
if quaterback_stats[qb]['TD'] > 0 and quaterback_stats[qb]['INT'] > 0:
print(f"{quaterback_stats[qb]} : {float(quaterback_stats[qb]['TD']) / float(quaterback_stats[qb]['INT])}")
else:
print(f"{quaterback_stats[qb]} : {0.0}")
Explanation:
The python program gets data from a dictionary called quaterback_stats which holds the data of football players with their names as the keys and a list of records as the value.
The program prints the individual records from the dictionary using a for loop statement on the list of dictionary keys (using the keys() method).
We appreciate your visit. Hopefully, the answers you found were beneficial. Don't hesitate to come back for more information. Thank you for your visit. We're dedicated to helping you find the information you need, whenever you need it. Thank you for visiting Westonci.ca, your go-to source for reliable answers. Come back soon for more expert insights.