HackerRank Python - Zipped

zip([iterable, ...])

This function returns a list of tuples. The th tuple contains the ith element from each of the argument sequences or iterables.

If the argument sequences are of unequal lengths, then the returned list is truncated to the length of the shortest argument sequence.

  1. # Enter your code here. Read input from STDIN. Print output to STDOUT
  2. n, x = map(int, input().split())
  3. sheet = []
  4. for _ in range(x):
  5. sheet.append(map(float, input().split()))
  6. for i in zip(*sheet):
  7. print(sum(i) / len(i))

download android app