Using Python Write Program Opens File Named Chap7pt1p1txt Asks User Enter String Character Q37100493

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.