Concatenate

Sort by

recency

|

440 Discussions

|

  • + 0 comments
    import numpy as np
    
    n, m, p = map(int, input().split())
    
    n_arr = np.array([list(map(int, input().split())) for i in range(n)])
    m_arr = np.array([list(map(int, input().split())) for i in range(n, n + m)])
    concatenated_arr = np.concatenate((n_arr, m_arr))
    
    print(concatenated_arr)
    
  • + 0 comments

    Fast :

    import sys, numpy
    
    entry = sys.stdin.read().splitlines()[1:]
    array = numpy.array([[int(tandem[0]), int(tandem[2])] for tandem in entry])
    print(array)
    
  • [deleted]Challenge Author
    + 0 comments

    For Python3

    import numpy as np
    
    n, m, p = map(int, input().split())
    lst1 = []
    lst2 = []
    
    for i in range(n):
        lst1.append(list(map(int, input().split())))
    for j in range(m):
        lst2.append(list(map(int, input().split())))
    
    arr1 = np.array(lst1)
    arr2 = np.array(lst2)
    
    print(np.concatenate((arr1, arr2), axis=0))
    
  • + 0 comments
    import numpy as np
    
    n, m, p = map(int,input().split())
    l = []
    for _ in range(n):
        l.append(list(map(int, input().split())))
    n_arr = np.array(l)
    l = []
    for _ in range(m):
        l.append(list(map(int, input().split())))
    m_arr = np.array(l)
    print(np.concatenate((n_arr, m_arr), axis = 0))
    
  • + 0 comments

    import numpy

    n, m, p = map(int, input().split()) n_list = [] m_list = [] for _ in range(n): n_list.append(list(map(int, input().split()))) n_array = numpy.array(n_list)
    for _ in range(m): m_list.append(list(map(int, input().split()))) m_array = numpy.array(m_list) print (numpy.concatenate((n_array, m_array), axis = 0))