Certified Associate in Python Programming (PCAP) — Question 91

You are going to read just one character from a stream called s. Which statement would you use?

Answer options

Correct answer: D

Explanation

The correct answer is D because the method s.read(1) is specifically designed to read a specified number of characters from the stream. Options A, B, and C are incorrect as they either use the wrong method or syntax that is not applicable for reading from the stream.