0% found this document useful (0 votes)
3 views2 pages

Python Programs - Array Concepts

The document outlines a series of Python programming exercises focused on using count-controlled loops with both 1D and 2D arrays. It includes tasks such as calculating sums, finding maximum and minimum values, searching for elements, and manipulating lists and arrays. Additionally, it covers advanced 2D array operations like matrix multiplication and diagonal sums.

Uploaded by

Naisha Vohra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Python Programs - Array Concepts

The document outlines a series of Python programming exercises focused on using count-controlled loops with both 1D and 2D arrays. It includes tasks such as calculating sums, finding maximum and minimum values, searching for elements, and manipulating lists and arrays. Additionally, it covers advanced 2D array operations like matrix multiplication and diagonal sums.

Uploaded by

Naisha Vohra
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Programs using list with Count controlled/Condition controlled looping

statements.

1D Array Programs:

1. Write a Python program to calculate the sum of all elements in a list using a
count-controlled loop.
2. Write a Python program to find the maximum and minimum values in a list using
a count-controlled loop.
3. Write a Python program to search for a specific element in a list using a count-
controlled loop.
4. Write a Python program to reverse the elements of a list using a count-controlled
loop.
5. Write a Python program to count the number of even and odd elements in a list
using a count-controlled loop.
6. Write a Python program to copy all elements from one list to another using a
count-controlled loop.
7. Write a Python program to insert an element at a specific position in a list using a
count-controlled loop.
8. Write a Python program to delete an element from a specific position in a list
using a count-controlled loop.
9. Write a Python program to sort a list in ascending order using a count-controlled
loop (e.g., bubble sort).
10. Write a Python program to merge two lists into a third list using a count-
controlled loop.
11. Write a Python program to calculate the average of elements in a list using a
count-controlled loop.
12. Write a Python program to count the number of positive, negative, and zero
elements in a list using a count-controlled loop.
13. Write a Python program to square each element in a list using a count-controlled
loop.
14. Write a Python program to find the second largest element in a list using a count-
controlled loop.
15. Write a Python program to check if a list is sorted in ascending order using a
count-controlled loop.

Use 2D array concept for the following programs

Use functions wherever appropriate


1. Write a Python program to input and display a 2D array using count-controlled
loops.
2. Write a Python program to calculate the sum of all elements in a 2D array using
count-controlled loops.
3. Write a Python program to find the maximum and minimum elements in a 2D
array using count-controlled loops.
4. Write a Python program to search for an element in a 2D array using count-
controlled loops.
5. Write a Python program to count the number of even and odd elements in a 2D
array using count-controlled loops.
6. Write a Python program to calculate the sum of each row in a 2D array using
count-controlled loops.
7. Write a Python program to calculate the sum of each column in a 2D array using
count-controlled loops.
8. Write a Python program to find the row with the maximum sum in a 2D array
using count-controlled loops.
9. Write a Python program to transpose a 2D array using count-controlled loops.
10. Write a Python program to check if a 2D array is symmetric using count-
controlled loops.
Advanced 2D Array Logic
11. Write a Python program to multiply two 2D arrays (matrices) using count-
controlled loops.
12. Write a Python program to find the diagonal elements of a square 2D array using
count-controlled loops.
13. Write a Python program to calculate the sum of the main diagonal and secondary
diagonal of a square 2D array using count-controlled loops.
14. Write a Python program to sort each row of a 2D array using count-controlled
loops.
15. Write a Python program to flatten a 2D array into a 1D list using count-controlled
loops.

You might also like