Year 11

Reading text files

Year 11

Reading text files

warning

These resources will be removed by end of Summer Term 2025.

Switch to our new teaching resources now - designed by teachers and leading subject experts, and tested in classrooms.

Lesson details

Key learning points

  1. In this lesson, we will be introduced to text files. The focus will be on reading text files, and how the data from a text file can be used within a program. We will be stepped through the key methods that are used for reading text files in Python, before we complete two text file challenges.

Licence

This content is made available by Oak National Academy Limited and its partners and licensed under Oak’s terms & conditions (Collection 1), except where otherwise stated.

Loading...

3 Questions

Q1.
A coded message has been created. Solve the message below: +3 FLSKHU
Correct answer: CIPHER
CODED
CRYPTIC
IOVNKX
Q2.
A coded message has been created. Solve the message below: +2 LWNKWU
GENIUS
JULIAN
Correct answer: JULIUS
NYPMYW
Q3.
A coded message has been created. Solve the message below: +4 TCXLUR
CIPHER
Correct answer: PYTHON
SCRIPT
XGBPYV

4 Questions

Q1.
If you want to open a text file in write format, what would you put in the highlighted space in this code?
An image in a quiz
a
r
r+
Correct answer: w
Q2.
If you want to open a text file and add to that file, what would you put in the highlighted space in this code?
An image in a quiz
Correct answer: a
r
r+
w
Q3.
If you want to open a text file and read that file, what would you put in the highlighted space in this code?
An image in a quiz
a
Correct answer: r
r+
w
Q4.
True or False: The readline() method always returns and additional line space at the end of it.
False
Correct answer: True