Assignment -Lists


Learning Objective: Learn Lists and List operations
  1. Program to read list of names and sort the list in alphabetical order.
  2. Program to find the sum of all even numbers in a group of n numbers entered by the user.
  3. Program to read a string and remove the given words from the string.
  4. Find the average word length of a sentence
  5. Program to read list of numbers and find the median
  6. Read list of numbers and find the standard deviation. (#We can find median by sorting the list and then take the middle element. If the list contains even number of elements take the average of the two middle elements. squre root of variance is the standard deviation)
  7. Finding the mode of list of numbers(A number that appears most often is the mode.
  8. Program to remove all duplicate elements from a list
  9. Consider a list consisting of integers, floating point numbers and strings. Separate them into different lists depending on the data
  10. Write a Python program to read list of positive integers and separate the prime and composite numbers
  11. Write a python code to input n numbers and calculate sum of cubes of each number and store it in a list.
  12. Write a Python program to check whether a list contains a sublist.Eg. Input 1: my_list = [3,4,5,2,7,8] , sub_list = [2,7]output 1: Trueinput 2: my_list = [3,4,5,2,7,8] , sub_list = [5,7]output 2: False
  13. Describe how Python supports arithmetic and comparison operations.Your team is developing a console-based student mark analyzer. The input is taken as a string of comma-separated marks. Demonstrate how to: 1. Parse and convert the input into numeric form.2. Classify each mark as "Fail", "Pass", or "Distinction" based on thresholds using appropriate control structures.3. Format and print the output with aligned columns. ( University question)
  14. Write a Python program to Input two lists from the user. Merge these lists into a third list such that in the merged list, all even numbers occur first followed by odd numbers. Both the even numbers and odd numbers should be in sorted order.
  15. Find the second largest and second smallest element from a list.
  16. Read a string and print the words in alphabetical order
  17. Read a string and print each words and its length. Also print number of words.
  18. Read a string and replace all occurrence of a word with another (use split() and join())
  19. Read a string and sort the words according to the length of the words.
  20. Read list of names and print the sorted list in uppercase letters.
  21. Read a string and remove all duplicate words.
  22. write a python program to input a sentence and find the number of words in the sentence and print the words in uppercase. Also print the number of question marks(?), periods(.) and commas(,) present in the string.
  23. Read list of numbers and check whether the given element in found in the list. If found display the positions else display the message element is not found.
  24. Write a function to add two numbers. Use this  two list elements ( use map with two lists)  
  25. Students marks of an exam is stored as a list. Create two list of marks from this.( passed and failed, less than 50% is failed). Also find the number of passed and failed students. Average marks of passed students,Top scorer and lowest mark scorer.

Comments

Popular posts from this blog

Programming in Python CST 362 KTU CS Sixth Semester Elective Notes

Turtle Graphics

Graphical User Interfaces ( GUI)