Activity 01
Pair Programming: Dictionary to CSV Writer
Pairs create a list of student dictionaries with keys like name, marks, grade. One partner dictates the code using csv.DictWriter, the other types and runs it to generate a CSV file. Switch roles, then verify output with a text editor and discuss header handling.
Construct a Python script to write a list of dictionaries to a CSV file.
Facilitation TipIn Pair Programming: Dictionary to CSV Writer, circulate and ask each pair to explain one line of their code to you before they run it, ensuring understanding of csv.writer and dictionary keys.
What to look forProvide students with a predefined list of dictionaries. Ask them to write the Python code to save this list to a CSV file named 'students.csv' with appropriate headers. Check if the file is created and contains the data correctly formatted.