Exercise 1 - Basic Python Solution Implementation

Input File Link

Solution format:

How you should write the python solution file solution:

  • There should be a main function that calls all the other function

  • Task 1 should be a function that takes in the filepath as the argument and returns the datastructure

  • Task 2-5 should be a function called sums that takes in the data and prints all the sums of each column

  • Task 6-8 should be a function called averages that takes in the data and prints all the averages of each column

  • Task 9-13 should be a function called single_number that takes in the data and prints all the values.

  • Task 14 should be a function called diagonal averages that takes in the data and prints the values.

  • Task 15-16 should be one function

Tasks:

  1. Using python read the input.txt and store the data in a datastrucure

Useful functions: readline() & readlines()

  1. Print out what is on line 691.

  2. Print what is the sum of first column

  3. Print what is the sum of second column

  4. Print what is the sum of third column

  5. Print the average of first column

  6. Print the average of second column

  7. Print the average of third column

  8. Calculate how many times the number 7 occurs in first column

  9. Calculate how many times the number 7 occurs in first and second column

  10. Print what number is the maximum from the first column

  11. Print what number is the maximum from the second column

  12. Print what number is the maximum from the third column

  13. Print the sum of the the diagonal from right to left.

  14. How many lines are there where the numbers are in ascending order?

  15. How many lines are there where the numbers are in decending order?