Skip to content

Study Hub

Study Guides

This pupil-friendly study guide includes a unit summary, clear notes, common mistakes, and quick questions with answers.

Year 11 - Computing

Writing to CSV files

Programming: dictionaries and data files

Unit Summary

This unit introduces pupils to the new data structures of records and dictionaries. They will develop a Caesar cipher encryption program using a dictionary as a cipher wheel. Pupils will explore how data can be read from and written to files and how this data can be used within a program.

Lesson Summary

You will learn to write data to a new file and append data to an existing text file.

Key Notes

  • Writing to a CSV happens line-by-line in the same way as other text files.
  • When writing to a CSV file you need to convert the data to a single string with commas used as separators.
  • The join() method takes a list and returns a string.

Vocabulary To Learn

  • list: a dynamic data structure that can contain items of different data types
  • string: a sequence of characters, e.g. letters, numbers, spaces, and other symbols
  • join(): the join method takes a list and joins each value in that list into one string

Common Mistakes To Avoid

  • You can write integers directly to a CSV file using file.write(number).

3 Quick Questions (With Answers)

1. Describe the system or process from this lesson in clear steps.

Writing to a CSV happens line-by-line in the same way as other text files. When writing to a CSV file you need to convert the data to a single string with commas used as separators.

2. Define this computing term and give one practical example. 'list'

a dynamic data structure that can contain items of different data types. Add one real device or system example to prove understanding.

3. Correct this common computing misconception.

Mistake: You can write integers directly to a CSV file using file.write(number). Correction: All data must be converted to strings before writing.

More Lessons In This Unit

Browse all guides in the Year 11 Computing guide library.