Question
create a file called file.txt and insert the following text: This is a test file Hello Student Testing 1,2,3 - testing ! Python rocks !
create a file called file.txt and insert the following text:
This is a test file Hello Student Testing 1,2,3 - testing ! Python rocks !
Follow the instructions below:
Write a code segment that opens a file named file.txt for input and prints the number of lines in that file.
Write a code segment that opens a file for input and prints the number of five-letter words in the file.
Write a code segment that prints the names of all the items in the current working directory.
Write a code segment that prompts the user for a file. If the file does not exist then the program should print an error. Otherwise, the program should print its contents.
Create a file called accounts.txt and enter the following information in the file
100 Mary 34.58 200 Alison 345.67 300 Marc 3.00 400 Zoltar -32.16 500 Kathleen 24.32
6. In the accounts.txt file:
update the name 'Zoltar' to 'Robert'
create a tempfile with the new data
remove accounts.txt file from the directory
rename the tempfile to a new file called myaccounts.txt
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started