Examine the given Python program and select the purpose of the program from…
2023
Examine the given Python program and select the purpose of the program from the following options: F=open('story.txt', 'r+') S=F.read() S=S.upper() F.seek(0) F.write(s) F.close()
- A.
to count the upper case alphabets present in the file
- B.
to convert all alphabets into uppercase in the file /
- C.
to copy only the upper case alphabets from the file
- D.
to remove all lower case alphabets from the file
Attempted by 1657 students.
Show answer & explanation
Correct answer: B
The purpose of this program is to convert the entire text of the file "story.txt" into uppercase and overwrite the file with the uppercase text .