Python Data Science Jobs & Interviews
20.3K subscribers
187 photos
4 videos
25 files
325 links
Your go-to hub for Python and Data Science—featuring questions, answers, quizzes, and interview tips to sharpen your skills and boost your career in the data-driven world.

Admin: @Hussein_Sheikho
Download Telegram
⁉️ Interview question 
Given the following NumPy code snippet, what will be the output and why?

import numpy as np

arr = np.array([[1, 2], [3, 4]])
result = arr + 5
print(result)

The output will be a 2x2 array where each element is incremented by 5: [[6, 7], [8, 9]]. This happens because NumPy automatically broadcasts the scalar value 5 to match the shape of the array, performing element-wise addition.

#️⃣ tags: #numpy #python #arrayaddition #broadcasting #interviewquestion #programming

By: t.iss.one/DataScienceQ 🚀