Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Murach's SQL Server 2012 For Developers

Authors: Bryan Syverson, Joel Murach, Mike Murach

1st Edition

1890774693, 9781890774691

More Books

Students also viewed these Databases questions

Question

internationalization of business?

Answered: 1 week ago