Skip to content

Commit d3f2e08

Browse files
authored
Merge pull request #728 from codewithdhruba01/doc/addQuestion
docs: add practice questions section to Array in Python page
2 parents 95e3e0d + a0ebb46 commit d3f2e08

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/python/python-array.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,44 @@ print(c) # array('i', [1, 2, 3, 4, 5])
227227

228228
---
229229

230+
### **Practice Questions**
231+
232+
1. **Basic Traversal**
233+
234+
**Q1**: Write a Python program to traverse an array and print each element on a new line.
235+
236+
2. **Maximum Element**
237+
238+
**Q2:** Write a Python program to find the maximum and minimum elements in an array without using built-in functions.
239+
240+
3. **Array Reversal**
241+
242+
**Q3:**** Write a Python program to reverse an array without using slicing or the reverse() method.
243+
244+
245+
4. **Insertion Operation**
246+
247+
**Q4:** Write a Python program to insert an element at a specific index in an array.
248+
249+
250+
5. **Deletion Operation**
251+
252+
**Q5:** Write a Python program to delete an element from a given index in an array.
253+
254+
6. **Search Element**
255+
256+
**Q6:** Write a Python program to search for a given element in an array and print its index if found, otherwise print "Not Found".
257+
258+
7. **Sum of Elements**
259+
260+
**Q7:** Write a Python program to find the sum of all elements in an array without using the sum() function.
261+
262+
8. **Second Largest Element**
263+
264+
**Q8:** Write a Python program to find the second largest element in an array.
265+
266+
---
267+
230268
## Conclusion
231269

232270
Python Arrays are useful when you need to store large amounts of **numeric data** of the same type efficiently.

0 commit comments

Comments
 (0)