Using Python Write a program that: Opens a file named”Chap7pt1P1.txt” Asks the user to enter a string of charactersStores the string of characters in the above file Closes the fileOpens the file again to read from it Reads the string of charactersin the file Prints the string on the screen Closes the file Sampleexecution: Enter a string of characters: Today is a great day! Thefile contains the text Today is a great day!
Solution
with open(‘Chap7pt1P1.txt’, ‘w’) as w: # open file line = input(“Enter a string of characters: “) w.write(line)with open(‘Chap7pt1P1.txt’) as
OR
OR