🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित कोड का परिणाम क्या है?

What is the output of the following code?

import numpy as np
a = np.array([1,2,3,5,8])
b = np.array([0,1,5,4,2])
c = a + b
c = c*a
print (c[2])
A)
B)
C)
D)

Explanation:

Let's simplify the explanation:

  1. Arrays:

    a = [1, 2, 3, 5, 8]
    b = [0, 1, 5, 4, 2]
    
  2. Adding arrays a and b:

    c = a + b  # [1+0, 2+1, 3+5, 5+4, 8+2] = [1, 3, 8, 9, 10]
    
  3. Multiplying c by a:

    c = c * a  # [1*1, 3*2, 8*3, 9*5, 10*8] = [1, 6, 24, 45, 80]
    
  4. Print the third element (c[2]):

    print(c[2])  # This is 24
    

Output: 24

Answer: (B) 24

Latest Updates