Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Both to be done in python with simple code. Lab Assignments Write a program that reads each line in a file, reverses its lines, and

Both to be done in python with simple code.

image text in transcribed

Lab Assignments Write a program that reads each line in a file, reverses its lines, and writes them to another file. For example, if the file input.txt contain the lines: 1. Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go. and you run your Python file then output.txt contains The lamb was sure to go. And everywhere that Mary went Its fleece was white as snow Mary had a little lamb Name your Python file: reverse.py 2. Write a program that reads a file babynames2000s.txt (given) and produces two files, boynames.txt and girlnames.txt, separating the data for the boys and girls. Further, add functionality to your code, that would create another text file named comboygirlnames.txt which stores all names that are both boy and girl names. Name your Python file: boys_and _girls.py

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

More Books

Students also viewed these Databases questions

Question

Explain the development of human resource management (HRM)

Answered: 1 week ago