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])

28th Jun 2018, 1:48 PM
Supriya Gangapatnam
Supriya Gangapatnam - avatar
3 ответов
+ 2
True I suggest you to use the playground for such kind of questions.
28th Jun 2018, 1:50 PM
Nikhil Dhama
Nikhil Dhama - avatar
+ 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
18th Aug 2023, 9:19 AM
Ekunsanmi Damilola Emmanuel
Ekunsanmi Damilola Emmanuel - avatar
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])
18th Mar 2023, 6:48 AM
Mwendwa Kilatya
Mwendwa Kilatya - avatar