Exercise 1 – 4 Homework 3 Solution

$24.99 $18.99

Exercise 1 – File merging Suppose we have two files file1.txt and file2.txt in the same folder as your python program (you can download the sample files on NYU Classes and put it in the same folder as your program). Write a program (in the main() in exercise1.py) which inserts all the content from file2.txt…

Rate this product

You’ll get a: zip file solution

 

Categorys:

Description

Rate this product

Exercise 1 – File merging

Suppose we have two files file1.txt and file2.txt in the same folder as your python program

(you can download the sample files on NYU Classes and put it in the same folder as your program).

Write a program (in the main() in exercise1.py) which inserts all the content from file2.txt

to the beginning of file1.txt.

After executing your program, only file1.txt will be updated, file2.txt will not change.

Exercise 2 – Generate New Hire Offer Letters

Write a program (in the main() in exercise2.py) which will generate individual offer letters

for new hires (one file for each new hire). The offer letters should be generated in the same

folder as the program and should be named with the following format:

offer letter for [Applicant Name].txt

Any space in the [Applicant Name] should be replaced with an underscore for the filenames.

Hint: The replace method on strings can be useful.

Your program should read the file new hires.txt (in the same folder) which contains the list of

new hires with each line containing the information to add in the offer letter for one new

hire. The pieces of information on one single line are separated by commas , .

Check the content of new hires.txt to understand the format.

NOTE: the total amount should keep two decimal places

Exercise 3 – Top Tourist Attractions in China

The top tourist attractions.txt file (in the same folder as your program) contains some top

tourist attractions in China and their location (Province). Check the format in the file.

This exercise consists of 5 tasks (to be coded in exercise3.py).

Exercise 4 – PM2.5

The Shanghai 2016 HourlyPM25.txt file (in the same folder as your program) contains some

hourly PM2.5 index in Shanghai for 2016. Check the format in the file. An index of -999

indicates that the data is not available.

This exercise consists of 5 tasks (to be coded in exercise4.py).

Exercise 1 - 4 Homework 3 Solution
$24.99 $18.99