Write a program to Declare a List in integers and Display a menu to do the
following:
1. Create a List
2. Reverse the List
3. Find Sum and Average
4. Accept data and search in List
5. Count Even and odd
When user select choice 1 accept n and list
When user select choice 2 it should reverses the list
When user selects choice 3 find sum without using built-in function
When user selects choice 4 accept a value and search in list
When user select choice 5 count number of even and odd
Answers
Answer:
Write a program to Declare a List in integers and Display a menu to do the
following:
1. Create a List
2. Reverse the List
3. Find Sum and Average
4. Accept data and search in List
5. Count Even and odd
When user select choice 1 accept n and list
When user select choice 2 it should reverses the list
When user selects choice 3 find sum without using built-in function
When user selects choice 4 accept a value and search in list
When user select choice 5 count number of even and odd
Explanation:
i think it is helful
Answer:
1. Write a Python program to sum all the items in a list. Go to the editor
Click me to see the sample solution
2. Write a Python program to multiplies all the items in a list. Go to the editor
Click me to see the sample solution
3. Write a Python program to get the largest number from a list. Go to the editor
Click me to see the sample solution
4. Write a Python program to get the smallest number from a list. Go to the editor
Click me to see the sample solution
5. Write a Python program to count the number of strings where the string length is 2 or more and the first and last character are same from a given list of strings. Go to the editor
Sample List : ['abc', 'xyz', 'aba', '1221']
Expected Result : 2
Click me to see the sample solution
6. Write a Python program to get a list, sorted in increasing order by the last element in each tuple from a given list of non-empty tuples. Go to the editor
Sample List : [(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)]
Expected Result : [(2, 1), (1, 2), (2, 3), (4, 4), (2, 5)]
Click me to see the sample solution
7. Write a Python program to remove duplicates from a list. Go to the editor
Click me to see the sample solution
8. Write a Python program to check a list is empty or not. Go to the editor
Click me to see the sample solution
9. Write a Python program to clone or copy a list. Go to the editor
Click me to see the sample solution
10. Write a Python program to find the list of words that are longer than n from a given list of words. Go to the editor
Click me to see the sample solution
11. Write a Python function that takes two lists and returns True if they have at least one common member. Go to the editor
Click me to see the sample solution
12. Write a Python program to print a specified list after removing the 0th, 4th and 5th elements. Go to the editor
Sample List : ['Red', 'Green', 'White', 'Black', 'Pink', 'Yellow']
Expected Output : ['Green', 'White', 'Black']
Click me to see the sample solution
13. Write a Python program to generate a 3*4*6 3D array whose each element is *. Go to the editor
Click me to see the sample solution
14. Write a Python program to print the numbers of a specified list after removing even numbers from it. Go to the editor
Click me to see the sample solution
15. Write a Python program to shuffle and print a specified list. Go to the editor
Click me to see the sample solution
16. Write a Python program to generate and print a list of first and last 5 elements where the values are square of numbers between 1 and 30 (both included). Go to the editor
Click me to see the sample solution
17. Write a Python program to generate and print a list except for the first 5 elements, where the values are square of numbers between 1 and 30 (both included). Go to the editor
Click me to see the sample solution
18. Write a Python program to generate all permutations of a list in Python. Go to the editor
Click me to see the sample solution
19. Write a Python program to get the difference between the two lists. Go to the editor
Click me to see the sample solution
20. Write a Python program access the index of a list. Go to the editor
Click me to see the sample solution
21. Write a Python program to convert a list of characters into a string. Go to the editor
Click me to see the sample solution
22. Write a Python program to find the index of an item in a specified list. Go to the editor
Click me to see the sample solution
23. Write a Python program to flatten a shallow list. Go to the editor
Click me to see the sample solution
24. Write a Python program to append a list to the second list. Go to the editor
Click me to see the sample solution
25. Write a Python program to select an item randomly from a list. Go to the