questions for python
Lab 13: Files and Exception Handling Question 1: Write a program that removes all the occurrences of a specified string from a text file. Your program should prompt the user to enter a filename and a string to be removed. Here is a sample run: Enter a filename: test.txt Enter the string to be removed: norning Done Question 2: Write a program that will count the number of characters, words, and lines in a file. Words are separated by a white space character. Your program should prompt the user to enter a filename. Here is a sample run: Enter a filename: test.txt 1777 characters 210 words 71 lines Question 3: Write a program that writes 100 integers created randomly into a file. Integers are separated by a space in the file. Read the data back from the file and display the sorted data. Your program should prompt the user to enter a filename. If the file already exists, do not override it. Here is a sample run: Enter a filename: test.txt The file already exists Enter a filename: testi.txt 20 34 43 ... 50
Please help me with these Lab 13: Files and Exception Handling Question 1: Write a program that removes all the occurrences of a specified string
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am