Pa 11

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Programming Assignment 11

 Due Oct 4 by 11:59pm


 Points 50
 Submitting a text entry box or a file upload

Part 1 and Part 2 must be written to separate files.

Part 1 (20 points):

Copy and paste the list of numbers (ints) in the attached file (integer_list.txt Download
integer_list.txt ) into your new .py file. Once you have copy and pasted the list, write a program
that iterates over the list of numbers and writes each number to a separate line in the file. The
writelines method can not be used. The file should be created in your home directory and
named numbers.txt. Display a message to the user after the numbers have been written to the file
successfully.  Use utf-8 character encoding.

Save the program in a file named write_numbers.py and attach the write_numbers.py file

Here is a sample run of the program:

Part 2 (30 points):

Write a program to read the file numbers.txt created in part 1 that was saved to your home
directory. As you read each number, keep track of how many times each of the numbers appear
in the file (use a dictionary with the number as the key and count as the value). Print the count of
each number and the sum of all the numbers in the file.
If the count information output is sorted by either number or count in ascending or
descending order, you will receive 10 points of extra credit.

Save the program in a file named read_numbers.py and attach the read_numbers.py file

Add the following comments to top of your .py files:

# Your name
# PA 11

You might also like