Poor granny

Report a typo

There is an interesting employee at the Health.inc clinic — a 200-year-old woman. Sadly, she refuses to use the computer for work. She asked us to reorder in alphabetical order her hand-written notes to simplify her searching on paper.

You need to write a function that takes as an argument a list of tuples, inserts them in a DB, and then prints its contents ordered by names (the name column) in alphabetical order. Note that each entry must be printed as tuple on the new line. Consider that the connection object is already created and is the conn variable. The table's name is patients.

Input list example:

[('Sarah', 'Covid-20'), ('Nick', 'A23N98'), ('Bob', 'Caries')]

Output example:

('Bob', 'Caries')
('Nick', 'A23N98')
('Sarah', 'Covid-20')
Write a program in Python 3
cursor = conn.cursor() # Don't rename the cursor

def insert_records(data):
# Write your code here

# In this task you mustn't close connection to DB.(Due to the checking features)
___

Create a free account to access the full topic