Python_Institute
PCAP-31-03 · Question #49
What is the expected output of the following code if there is no file named non existing_file inside the working directory?
The correct answer is B. 1 3. f = open("linije","w") print(1, end="") s = f.readline() print(2, end="") except IOError as error: print(3, end="")
Technology and architecture
Question
What is the expected output of the following code if there is no file named non existing_file inside the working directory?
Exhibit
Options
- A2 2
- B1 3
- C1 2 3
- D2 2 3
How the community answered
(65 responses)- A14% (9)
- B77% (50)
- C3% (2)
- D6% (4)
Explanation
f = open("linije","w") print(1, end="") s = f.readline() print(2, end="") except IOError as error: print(3, end="")
Topics
#file exceptions#error handling#output prediction#Python I/O
Community Discussion
No community discussion yet for this question.
