Question:

Consider the following code and specify the correct order of the statements to be written:
Code:
(A) f.write(”CUET EXAMINATION”)
(B) f=open(”CUET.TXT”, ”w”)
(C) print(”Data is Written Successfully”)
(D) f.close()
Choose the correct answer from the options given below:

Updated On: Nov 4, 2024
  • (A), (B), (C), (D)
  • (B), (A), (C), (D)
  • (B), (D), (C), (A)
  • (B), (D), (A), (C)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

In Python, the correct sequence for file handling includes opening the file, writing to it, printing a success message, and then closing the file.
Was this answer helpful?
0
0