#
Unit 3
Long answer question of Python Programming

Q1 Discuss function in python with its parts and scope. Explain with example. (Take Simple calculator with add, subtract, Division and Multiplication). . [ 2019-20]

Q2 Explain higher order function with respect to lambda expression. Write a Python code to Count occurrences of an element in a list. . [ 2019-20]

Q3 Explain Unpacking Sequences, Mutable Sequences, and List Comprehension with example. Write a program to sort list of dictionaries by values in Python â€“ Using lambda function. [ 2019-20] [21-22]

Q5 Write a Python function removekth (s, k) that takes as input a string S and an integer k>=0 and removes the character at index k. If k is beyond the length of S, the whole of S is retuned. For example.

removekth(“PYTHON”,1) returns “PTHON”

removekth(“PYTHON”, 3)returns “PYTON”

removekth(“PYTHON”, 0) returns “PYTHON”

removekth(“PYTHON”, 20) returns “PYTHON” [2020-2021]

Q6 Write a function less than(1st, k) to return list of numbers less 10 than k from a list 1st. The function must Tist comprehension. Example:

lessthan ([1, 2, 0, 5, -31, returns [-2, -3] [2020-2021]

Q7 Write a program factors (N) that returns a list of all positive divisors of N (N-1). For example: factors (6) returns [1,2,3,6]

factors (1) returns [1]

factors(13) returns [1,13] [2020-2021]

Q8 Write a Python program to change a given string to a new string where the first and last chars have been exchanged [2021-22]

Q9 Write a Python program to add an item in a tuple. [2021-22]

You may Like to Read this

PYTHON PROGRAMMING ALL STUDY MATERIAL || 99+ MOST IMPORTANT QUESTION WITH SOLUTION