Search Header Logo
Year 10 Text Files

Year 10 Text Files

Assessment

Presentation

Computers

10th Grade

Medium

Created by

Roy Duguid

Used 13+ times

FREE Resource

15 Slides • 6 Questions

1

Do Now:

Paper 1 - programming > Reading and Writing to files > Do Now

2

Big Question: How can we use Python to read from and write to text files efficiently?

​Lesson Objectives:

Understand the structure and purpose of text files. Learn how to read data from a text file using Python.

Gain proficiency in writing data to a text file using Python.

Develop error handling skills when working with text files.

Apply file handling techniques to solve practical problems.

Key words:

Text files, Read, Write, File handling, Open() Modes (read, write, append), Error handling, Data manipulation

3

media

4

media

5

media

6

media

7

media

8

media

9

media

10

media

11

media

14

​Questions ahead...

15

Multiple Choice

This command will open file = open("mytext.txt", "r")

1

To read the file

2

To append to the file

3

To write to the file

16

Multiple Choice

This command will open file = open("mytext.txt", "w")

1

To read the file

2

To append to the file

3

To write to the file

17

Multiple Choice

If I want to add to the end of a text file, I should:

1

file = open("file.txt", "w")

2

file = open("file.txt", "a")

3

file = open("file.txt", "w+")

4

file = open("file.txt", "s")

18

Multiple Select

Which of these will generate an error?

1

file.write("writing")

2

file..write(writing)

3

file.write("writing",writing)

4

file.writetofile()

19

Multiple Select

How do you close the file?

1

file = close

2

file.close

3

close = file()

20

Multiple Select

Why do we close txt files after we are done with them?

1

This frees up any memory used by having it open

2

It makes no difference if its closed or not

3

Once closed, the file cannot be read from or written to without opening it again

4

It's easier to write to once it's closed

21

​Go to class notebook

Complete challenges

Do Now:

Paper 1 - programming > Reading and Writing to files > Do Now

Show answer

Auto Play

Slide 1 / 21

SLIDE