We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
import numpy as np
x = list(map(int, input().split()))
l = len(x)
if l==3:
a = np.zeros((x[0],x[1],x[2]),int)
b = np.ones((x[0],x[1],x[2]),int)
if l == 4:
a = np.zeros((x[0],x[1],x[2],x[3]),int)
b = np.ones((x[0],x[1],x[2],x[3]),int)
if l == 2:
a = np.zeros((x[0],x[1]),int)
b = np.ones((x[0],x[1]),int)
print(a)
print(b)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Zeros and Ones
You are viewing a single comment's thread. Return to all comments →
import numpy as np x = list(map(int, input().split()))
l = len(x) if l==3: a = np.zeros((x[0],x[1],x[2]),int) b = np.ones((x[0],x[1],x[2]),int) if l == 4: a = np.zeros((x[0],x[1],x[2],x[3]),int) b = np.ones((x[0],x[1],x[2],x[3]),int) if l == 2: a = np.zeros((x[0],x[1]),int) b = np.ones((x[0],x[1]),int) print(a) print(b)