P-Assignment 11: Lists
Hi,
Please do the following programs.
Mode: Easy
- Write a python script to read ‘n’ elements in to the list. Subsequently split the even numbers and odd numbers in the list to two separate sub lists.
- Write a python script to read ‘n’ number of “even” elements in to the list. If user enters odd number, display a message that, you should enter only even numbers.
- Write a python script to read ‘n’ number of “odd” elements in to the list. If user enters even number, display a message that, you should enter only odd numbers.
- Write a python script to find the second largest element in the list.
- Write a python script to read ‘n’ elements in to two lists and merge the elements in to a single list and sort it.
- Write a python script to swap the ‘first’ and ‘last’ elements in the list.
- Write a python script to display the even numbers in the list which are less than 100.
- Write a python script to display the odd numbers in the list which are greater than 100.
- Write a python script to merge two lists in to a single list. If there are any duplicates then print only one element. for example if ‘list 1’ contains [1,2,3] and ‘list 2’ contains [3,4,5] the output is [1,2,3,4,5]
- Write a python script to read ‘n’ strings in to a list and print the longest string in the given list.