Python - Formatted String Literals: Make Charts from Data - f-string, triple-quoted string
Head First Python: A Learner’s Guide to the Fundamentals of Python Programming, A Brain-Friendly Guide、 Paul Barry(著)、 O’Reilly Mediaの Chapter 5.(Formatted String Literals: Make Charts from Data)、EXERCISE(261/682)の解答を求めてみる。
Jupyter(コード、入出力結果)
Charts.ipynb
title = f'{swimmer} (Under {age}) {distance} {stroke}'
title
'Darius (Under 13) 100m Fly'
html = f'''
<html>
<head>
<title>{title}</title>
</head>
<body>
<h3>A simple bar chart</h3>
'''
html
'\n<html>\n <head>\n <title>Darius (Under 13) 100m Fly</title>\n </head>\n <body>\n <h3>A simple bar chart</h3>\n'