Sum and Prod

Sort by

recency

|

357 Discussions

|

  • [deleted]Challenge Author
    + 0 comments

    For Python3

    import numpy
    
    n, m = map(int, input().split())
    lst = []
    
    for i in range(n):
        lst.append([*map(int, input().split())])
    
    arr = numpy.array(lst)
    
    print(numpy.prod(numpy.sum(arr, axis=0)))
    
  • + 0 comments
    import numpy as np
    
    n, m = map(int,input().strip().split())
    arr_1 = np.array([input().strip().split()[:m] for _ in range(n)], dtype=np.int32) 
    print(np.prod( np.sum(arr_1, axis=0) ))
    
  • + 0 comments

    easy two liner:

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

    import numpy N, M = list(map(int, input().split())) my_array = numpy.array([input().strip().split()[:M] for _ in range(N)], dtype=numpy.int32) print(numpy.prod(numpy.sum(my_array, axis=0)))

  • + 0 comments

    import numpy as np

    n,m = map(int, input().split()) a= [] for i in range(n): a.append(list(map(int, input().split()))) print(np.prod(np.sum(a, axis = 0)))