#!/bin/python3 import sys from pprint import pprint #input_f = "input" #sys.argv[1] input_f = sys.argv[1] sum = 0 with open(input_f) as file: for line in file: line = list(map(int,line.rstrip('\n').split())) ######################################### # # # Part 1 # # # ######################################### sum+=(max(line)-min(line)) print(sum) ######################################### # # # Part 2 # # # ######################################### sum = 0 with open(input_f) as file: for line in file: line = list(map(int,line.rstrip('\n').split())) for idx,i in enumerate(line): length=len(line) for j in range(0,length): if i % line[j] == 0 and idx != j: sum+=int(i/line[j]) print(sum)