Wednesday, 4 February 2026

Assignment 5(List,Tuple)

 


Part A: Lists

  1. Write a Python program to create a list of 6 integers and display the list.

  2. Write a program to access and print:

    • the first element

    • the last element
      from a given list using indexing.

  3. Write a Python program to take 5 numbers from the user and store them in a list.

  4. Write a program to add three new elements to an existing list using the append() method.

  5. Given a list of numbers, write a program to remove a specific element entered by the user.

  6. Write a program to sort a list of integers in ascending order.

  7. Write a program to sort the same list in descending order.

  8. Write a Python program to find the maximum and minimum values in a list.

  9. Write a program to calculate the sum and average of elements in a list.

  10. Write a program to count how many times a given element appears in a list.


Part B: Tuples

  1. Write a Python program to create a tuple of 5 strings and print it.

  2. Write a program to access elements of a tuple using indexing.

  3. Write a Python program to demonstrate that tuples are immutable by attempting to modify an element.

  4. Given a tuple of integers, write a program to count the occurrence of a specific number.

  5. 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

Popular Posts

Categories

100 Python Programs for Beginner (118) AI (191) Android (25) AngularJS (1) Api (7) Assembly Language (2) aws (28) Azure (8) BI (10) Books (262) Bootcamp (1) C (78) C# (12) C++ (83) Course (84) Coursera (299) Cybersecurity (29) data (1) Data Analysis (25) Data Analytics (18) data management (15) Data Science (260) Data Strucures (15) Deep Learning (107) Django (16) Downloads (3) edx (21) Engineering (15) Euron (30) Events (7) Excel (18) Finance (9) flask (3) flutter (1) FPL (17) Generative AI (54) Git (9) Google (47) Hadoop (3) HTML Quiz (1) HTML&CSS (48) IBM (41) IoT (3) IS (25) Java (99) Leet Code (4) Machine Learning (230) Meta (24) MICHIGAN (5) microsoft (9) Nvidia (8) Pandas (13) PHP (20) Projects (32) Python (1247) Python Coding Challenge (1002) Python Mistakes (43) Python Quiz (411) Python Tips (5) Questions (3) R (72) React (7) Scripting (3) security (4) Selenium Webdriver (4) Software (19) SQL (46) Udemy (17) UX Research (1) web application (11) Web development (8) web scraping (3)

Followers

Python Coding for Kids ( Free Demo for Everyone)