Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1 5 , 6 , 8 , 7 , 8 , 9 , 2 , 3 , 2 , 8 , 6 , 9
Part
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 character encoding.
Here is a sample run of the program:
The integer list has been written to the file Usersjeffanumberstxt
Part
Write a program to read the file numbers.txt created in part 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.
Here is a sample run of the program:
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
Number is in the list times.
The total of all the numbers in the list is:
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