books = [("Dan brown", "Davinci Code"), ("Bram Stoker", "Dracula"), ("Murakami", "Tokio Blues")]
def a():
index = 1
for item in books:
author, book = item
print(f"{index}: {book} by {author}")
index += 1
def b():
for i in range(len(books)):
author, book = books[i]
print(f"{i + 1}: {book} by {author}")
def c():
for index, (author, book) in enumerate(books, 1):
print(f"{index}: {book} by {author}")
# To execute
funcs = (a, b, c)
for func in funcs:
print("-" * 8)
print(f"function: {func.__name__}")
print("-" * 8)
func()
To embed this project on your website, copy the following code and paste it into your website's HTML: