Exercise 1 - Basic Python Solution Implementation
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:
- Using python read the
input.txt
and store the data in a datastrucure
Useful functions: readline()
& readlines()
-
Print out what is on line 691.
-
Print what is the sum of first column
-
Print what is the sum of second column
-
Print what is the sum of third column
-
Print the average of first column
-
Print the average of second column
-
Print the average of third column
-
Calculate how many times the number 7 occurs in first column
-
Calculate how many times the number 7 occurs in first and second column
-
Print what number is the maximum from the first column
-
Print what number is the maximum from the second column
-
Print what number is the maximum from the third column
-
Print the sum of the the diagonal from right to left.
-
How many lines are there where the numbers are in ascending order?
-
How many lines are there where the numbers are in decending order?