0
How many charcters would be in each line printed by this code, if one character is 2 bytes?
file =open("filename.text", "r") for i in range(21): print(file.read(4)) file.close()
2 Réponses
0
Each line printed by this code will have 84 characters, and the total data read from the file is 168 bytes.
-Lmk if this helped!-
0
xJAYOx, you misread the question, also made a wrong calculation.
It is the exercise in Python Developer, previous slide says:
"Each ASCII character is 1 byte"
So print(file.read(1)) prints ONE character, print(file.read(5)) prints FIVE characters and so on.
What would happen if each character is 2 bytes?
It is a simple division calculation.