Computer Science, asked by harshbhardwaj70, 1 year ago

Write a Python program/function to copy the contents from story.txt to novel.txt in Capital letter...​

Answers

Answered by LuckyYadav2578
6

Python program/function to copy the contents from story.txt to novel.txt in Capital letter.

file = open("story.txt",'r')

a = file.read()

CopyFile = open('novel.txt','w')

UC = a.upper()

CopyFile.write(UC)

file.close()

CopyFile.close()

About the programme

  • Open the content stored in story.txt in variable file.
  • And read the file in variable a.
  • Open the file novel.txt where you have to copy the file in the variable CopyFile.
  • Uppercase the content by using upper function.
  • then write the uppercase variable in the CopyFile
  • close the file
  • close the CopyFile.

About some functions that I am using

  • open () - To open the file.
  • read () - used to read the content.
  • upper () - to make the content in uppercase.
  • write () -used to write the content.
  • close () -used to close the file.
Similar questions