Sum and Prod

Sort by

recency

|

369 Discussions

|

  • + 0 comments

    Here is HackerRank Sum and Prod in Python solution - https://programmingoneonone.com/hackerrank-sum-and-prod-problem-solution-in-python.html

  • + 0 comments

    import numpy

    n,m = [int(x) for x in input().split()]

    l =[] for i in range(n): l.append([int(x) for x in input().split()]) a = numpy.array(l) print(numpy.sum(a,axis =0).prod())

  • + 0 comments
    import numpy as np
    
    n, m = map(int, input().split())
    
    val = np.array([list(map(int, input().split())) for i in range(n)])
    
    print(np.prod(np.sum(val, axis=0)))
    
  • + 0 comments

    import numpy

    n,m = map(int, input().split())

    data = []

    for _ in range(n): data.append(list(map(int, input().split())))

    array = numpy.array(data)

    col_sum = numpy.sum(array, axis=0) result = numpy.prod(col_sum) print(result)

  • + 0 comments
    import numpy as np
    
    a = np.array([list(map(int, input().split(' '))) for _ in range(int(input()[-1]))])
    a = np.sum(a, axis=0)
    
    print(np.prod(a))