Python - Flask - gazpacho - Working with Data - Data Manipulationg - list, html, markup
Head First Python: A Learner’s Guide to the Fundamentals of Python Programming, A Brain-Friendly Guide、 Paul Barry(著)、 O’Reilly Mediaの Chapter 10.(Working with Data: Data Manipulation)、EXERCISE(475/682)の解答を求めてみる。
コード
def produce_bar_chart(filename: str):
RECORDS = (0, 1, 3, 4)
COURSES = ('LC Men', 'LC Women', 'SC Men', 'SC Women')
times = []
for course in COURSES:
times.append(records[course][event_lookup(filename)])
footer = f'''
<p>Average time: {average}</p>
<p>M: {times[0]} ({times[2]})</p>
<p>W: {times[1]} ({times[3]})</p>
'''