🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित में से कौन सी त्रुटि दिए गए कोड द्वारा लौटाई जाती है?

Which of the following error is returned by the given code ?

>>> f = open(“test.txt”,”w”) 
>>> f.write(345) 
A)
B)
C)
D)

Explanation:

In Python, the write() method expects a string as an argument, but 345 is an integer. Therefore, attempting to write an integer directly to a file will cause a TypeError.

Answer: (B) Type Error

Latest Updates