Example HTML page

P-Assignment 11: Lists

Hi,

Please do the following programs.

Mode: Easy

  1. 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.
  2. 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.
  3. 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.
  4. Write a python script to find the second largest element in the list.
  5. Write a python script to read ‘n’ elements in to two lists and merge the elements in to a single list and sort it.
  6. Write a python script to swap the ‘first’ and ‘last’ elements in the list.
  7. Write a python script to display the even numbers in the list which are less than 100.
  8. Write a python script to display the odd numbers in the list which are greater than 100.
  9. 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]
  10. Write a python script to read ‘n’ strings in to a list and print the longest string in the given list.
Example HTML page

Leave a Reply

Your email address will not be published. Required fields are marked *

Pin It on Pinterest