0
What is the output of this code?
import numpy as np a=np.arange(0,8,2) b=np.arange(1,8,3) print(a[2]==b[1])
3 odpowiedzi
+ 2
True
I suggest you to use the playground for such kind of questions.
+ 1
x = np.arange(2, 8, 2)
x = np.append(x, x.size)
x = np.sort(x)
print(x[1])
Answer = 3
for np.arrange add the first and last number in the array which is 2 + 2, you get 4 add that answer (4) to the last number again you get 6, for x = np.arrange answer is (2,4,6), for np.append(x,x.size) answer is (2,4,6,3) for np.sort(x) answer is (2,3,4,6)... for print(x[1]) answer is 3... remember your indexes python starts from 0
0
What is the output of this code?
x = np.arange(2, 8, 2)
x = np.append(x, x.size)
x = np.sort(x)
print(x[1])