❔ Interview question
**What will be the output of this code?**
```python
x = [1, 2, 3]
y = x[:]
y[0] = 10
print(x)
```
Answer:
<spoiler>||[1, 2, 3]||</spoiler>
tags: #python #interview #coding #programming #list #slicing #mutable #dev
By: t.iss.one/DataScienceQ 🚀
**What will be the output of this code?**
```python
x = [1, 2, 3]
y = x[:]
y[0] = 10
print(x)
```
Answer:
<spoiler>||[1, 2, 3]||</spoiler>
tags: #python #interview #coding #programming #list #slicing #mutable #dev
By: t.iss.one/DataScienceQ 🚀
Telegram
Python Data Science Jobs & Interviews
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
Admin: @Hussein_Sheikho
⁉️ Interview question
What will be the output of the following NumPy code snippet?
<details><summary>Click to reveal</summary>Answer: [3 5]</details>
#️⃣ tags: #numpy #python #interviewquestion #arrayoperations #slicing #broadcasting
By: @DataScienceQ 🚀
What will be the output of the following NumPy code snippet?
import numpy as np
arr = np.array([1, 2, 3, 4, 5])
result = arr[1:4:2] + arr[::2]
print(result)
#️⃣ tags: #numpy #python #interviewquestion #arrayoperations #slicing #broadcasting
By: @DataScienceQ 🚀