Part A: Lists
-
Write a Python program to create a list of 6 integers and display the list.
-
Write a program to access and print:
-
the first element
-
the last element
from a given list using indexing.
-
-
Write a Python program to take 5 numbers from the user and store them in a list.
-
Write a program to add three new elements to an existing list using the
append()method. -
Given a list of numbers, write a program to remove a specific element entered by the user.
-
Write a program to sort a list of integers in ascending order.
-
Write a program to sort the same list in descending order.
-
Write a Python program to find the maximum and minimum values in a list.
-
Write a program to calculate the sum and average of elements in a list.
-
Write a program to count how many times a given element appears in a list.
Part B: Tuples
-
Write a Python program to create a tuple of 5 strings and print it.
-
Write a program to access elements of a tuple using indexing.
-
Write a Python program to demonstrate that tuples are immutable by attempting to modify an element.
-
Given a tuple of integers, write a program to count the occurrence of a specific number.
-
Write a Python program to convert a tuple into a list, add an element, and convert it back into a tuple.

0 Comments:
Post a Comment