List Assignments
Basic Level Questions
Write a Python program that asks the user to enter a sentence and then prints the words in the sentence in alphabetical order.
Take name of five fruit from user through loop and store into a bucket made by list and print name of each fruit in the bucket.
Create a list of ten numbers and print only the even numbers in the list.
Create a list of five strings and print the length of each string.
Take a sentence from user and print only those words which are of even length.
Create a list of ten numbers and print the largest number in the list.
Write a python program to remove duplicates from a list.
Write a program to add all the elements of the list. Also find the length of the list using loop.
Intermediate and Advanced Level Questions
Given a list of integers, write a program to find the sum of all even numbers in the list. Example input:
[1, 2, 3, 4, 5, 6]
Output:12
Write a program to merge two lists into a single list without using the built-in
extend()
or+
operators. Example input:[1, 2, 3]
,[4, 5, 6]
Output:[1, 2, 3, 4, 5, 6]
Given a list of strings, write a program to find the longest string in the list. Example input:
['hello', 'world', 'how', 'are', 'you']
Output:'world'
Reverse a list without using reverse() function.
Write a python program to find the common elements between two lists.
Write a python program to create a list of numbers. Print the sum of the elements of even index and odd index separately.
Write a program to store average marks of 10 students in a list and print the number of students falling the following categories in two columns: Average Marks Number of Students 1 - 30 xx 31 - 50 xx 51 - 70 xx 71 - 85 xx 86 - 100 xx
Write a program to create a list of numbers and print the list of numbers after reversing each number in the list.
Write a python program to create a list and sort it using the built-in function of list in descending order.
Write a program to create two lists of 5 numbers each and print the list after adding corresponding elements of the two lists.
Write a program to create a list of 5 numbers and print the list after replacing all the odd numbers with their squares.
Write a program to create a list of 5 strings and print the list after reversing each string in the list.
Write a program to create a list of 5 strings and print the list after removing all the vowels from each string.
Write a program to create a list of 5 numbers and print the list after inserting a new number at the beginning of the list and sorting the list in ascending order.
Take a sentence from user and print each word separated by ,
Write a program to create a list of 10 numbers and print the list after replacing each number with the difference between itself and the previous number in the list. The first number should remain the same.
Write a program to create a list of 5 strings and print the list after removing all the strings which have a length less than the average length of all the strings in the list.
Write a program to create a list of 5 strings and print the list after removing all the vowels from the first and last strings in the list.
Suppose a list contains 20 integers generated randomly. Receive a number from the keyboard and report position of all occurrences of this number in the list.
Suppose a list contains positive and negative numbers. Write a program to create two lists - one containing positive numbers and another containing negative numbers.
Take a sentence from user and create a list and print the list of first letter of each word in the first list.
Create a menu driven python program on Student Management System using list. Options to be in your program 1. Add 2. View All Students 3. Search by name 4. Search by roll number 5. Update Students Details 6. Delete Student 7. Exit Program should ask the user to exit.
Last updated