Font size
WorksheetsPython Basic files
Total questions: 10
Worksheet time: 5mins
This command will open MyFile = open("MyText.txt")
To read the file
To append to the file
To write to the file
If I want to add to the end of a text file, I should:
MyCipher = open("MyCipher.txt", "w")
MyCipher = open("MyCipher.txt", "a")
MyCipher = open("MyCipher.txt", "w+")
MyCipher = open("MyCipher.txt", "s")
Which of these will generate an error?
MyCipher.write("writing")
MyCipher..write(writing)
MyCipher.write("writing",writing)
MyCipher.readline()
How do you close the file?
MyFile = close()
MyFile.close
close = MyFile()
MyFile.close()
Why is it best to open a file with with in Python?
It automatically closes the file
Easier to read the code
Better for binary files
Closers to the pseudocode
Which is the best type of loop to write a file in?
While loop
for loop
repeat loop
What command can you use to separate parts of a line?
separate()
split()
divide()
cut()
What command can you use to send back data from a function?
return
sendback
back
print()
How do you assign variables in pseudocode?
←
=
==
assign
How do you CALL the function name in Python?
name()
def name()
call name()
GOTO name()
