
file_handling_BN23
Presentation
•
Computers
•
9th - 12th Grade
•
Practice Problem
•
Medium
Brian New
Used 2+ times
FREE Resource
10 Slides • 10 Questions
1
File Handling
CS
2
goals
O I can accurately describe how to handle a file
O I can write python code to read and write data to a file
3
Open Ended
When file handling, an endOfFile() command is very important.
Describe what this is as best you can.
4
endOfFile()
The endOfFile() command simply returns True or False as to whether we have reached the last line (or end) of a file. It allows code to detect when to stop reading from a file -- there is no more data to read.
5
Multiple Choice
endOfFile() returns what?
a string
an integer
a boolean
the last line
6
Multiple Choice
endOfFile(), if returning True, means that we can keep reading data from a file...
No, because we have now arrived at the end of the file.
Yes, because there will be room at the end of the file to read more.
7
Multiple Choice
Why would we need to use endOfFile() in code?
To prepare a file for new data.
To stamp the end of data with an 'end point'.
To close a file for safety.
To detect when a loop needs to stop reading from a file.
8
goals
O I can accurately describe how to handle a file
O I can write python code to read and write data to a file
9
Open Ended
Now briefly describe everything you know about what the endOfFile() command is and what it is used for.
Bonus points for making your answer sound like it was written by a very angry wizard.
10
follow the link
add a new text file and write your own conversation
11
Why don't we need to use the endOfFile() command in this code?
12
Open Ended
# Write 4 brief, one-line comments that would help someone undertand the file handling parts of this code.
# At the start of each comment, specify which line the comment is about.
E.g. # (3) This imports the time module so that we can use the sleep() procedure.
13
goals
O I can accurately describe how to handle a file
O I can write python code to read and write data to a file
14
Fill in the Blanks
15
Fill in the Blanks
16
Fill in the Blanks
17
Draw
Draw an image to express why a file should be 'closed' after we have used it.
18
copy this code into a new project
can you work out how to format the 'characters' text file? Create a new text file that would work with this program.
19
20
goals
O I can accurately describe how to handle a file
O I can write python code to read and write data to a file
File Handling
CS
Show answer
Auto Play
Slide 1 / 20
SLIDE
Similar Resources on Wayground
15 questions
Y1 ICT Topic: Inserting Online Pictures in the Spreadsheet
Presentation
•
KG
15 questions
Energy
Presentation
•
9th - 12th Grade
15 questions
Etymology/Word within the Word
Presentation
•
9th - 12th Grade
15 questions
Nuclear Fission vs Nuclear Fusion
Presentation
•
9th - 12th Grade
15 questions
Graphic Design: Software
Presentation
•
9th - 12th Grade
14 questions
AP CSP Unit 1 Test Review
Presentation
•
10th - 12th Grade
14 questions
Building and Maintaining a Website
Presentation
•
9th - 12th Grade
13 questions
For Loop
Presentation
•
8th - 12th Grade
Popular Resources on Wayground
10 questions
HCS SCI 03 Summer School Review 4
Quiz
•
3rd Grade
11 questions
HSMS - Standard Response Protocol
Quiz
•
6th - 8th Grade
16 questions
1.1-1.2 Quiz Review
Quiz
•
9th - 12th Grade
12 questions
Exponent Expressions
Quiz
•
6th Grade
20 questions
Adding and Subtracting Integers
Quiz
•
6th - 7th Grade
11 questions
Northeast States
Quiz
•
3rd - 4th Grade
10 questions
Characterization
Quiz
•
3rd - 7th Grade
10 questions
Common Denominators
Quiz
•
5th Grade