Lists: Creation, indexing, slicing, methods (append(), pop(), sort()), intro to list comprehension

  1. Write a Python program to create a list of five student marks and display the list ?
  2. Write a Python program to display the first and last elements of a list using indexing ?
  3. Write a Python program to find the length of a list ?
  4. Write a Python program to extract the first three elements using list slicing ?
  5. Write a Python program to add a new subject to a subject list using append() ?
  6. Write a Python program to remove the last element from a list using pop() ?
  7. Write a Python program to sort a list of numbers in ascending order ?
  8. Write a Python program to find the largest and smallest elements in a list ?
  9. Write a Python program to count even numbers in a list ?
  10. Write a Python program to reverse a list using slicing ?
  11. Write a Python program to swap the first and last elements of a list ?
  12. Write a Python program to create a list of squares using list comprehension ?
  13. Write a Python program to create a list containing only positive numbers from a given list using list
    comprehension ?
  14. Write a Python program to display alternate elements of a list using slicing ?
  15. Write a Python program to find the sum of all elements in a list ?
  16. Write a Python program to create a 3×3 matrix using nested list comprehensions  ?
  17. Write a Python program to generate a list of student grades using list comprehension and conditional
    expressions ?
  18. Write a Python program to merge two lists and sort the resulting list ?
  19. Write a Python program to create a multiplication table list using list comprehension ?
  20. Write a Python program to identify all prime numbers from a given list ?
Previous Topic Strings: Indexing, slicing, split(), strip(), find(), replace(), formatting using f-strings Next Topic Tuples: Immutable nature, tuple unpacking