Page 274 - CTS - CSA TP - Volume 2
P. 274
COMPUTER SOFTWARE APPLICATION - CITS
Related Exercises:
1 Write a Python program to create a list of integers and display its elements.
2 Create a list of strings and print the length of the list.
3. Write a program to concatenate two lists.
4 Implement a Python program to find the sum of elements in a numeric list.
5 Create a list of numbers and remove the duplicates.
6 Write a program to reverse a list.
7 Generate a list of squares of numbers from 1 to 10 using list comprehension.
8 Create a new list containing only even numbers from an existing list.
9 Implement a program to add two matrices using lists.
10 Write a Python script to find the transpose of a matrix.
11 Create a list of words and sort them in alphabetical order.
12 Write a program to sort a list of numbers in descending order.
13 Implement a program to extract a sub-list from a given list.
14 Write a Python script to reverse every alternate sublist of a list.
15 Create a program to check if a specific element exists in a list.
16 Write a Python function to find the index of the first occurrence of an element in a list.
17 Implement a Python program to flatten a nested list.
18 Write a script to find the sum of each row in a matrix represented as a list of lists.
19 Create a program to find the second-largest element in a list.
20 Implement a Python function to rotate a list by a given number of positions
Tuples
A tuple in Python is a collection of ordered, immutable elements. Tuples are similar to lists, but the key difference
is that tuples are immutable, meaning their elements cannot be changed or modified once the tuple is created.
Tuples are defined using parentheses ().
Creating a Tuple
Accessing Elements
259
CITS : IT & ITES - Computer Software Application - Exercise 128 CITS : IT & ITES - Computer Software Application - Exercise 128