This repository contains a collection of theory and practical questions on Python Functions, Iterators, Generators, and DSA-related concepts.
It is designed to demonstrate problem-solving skills and hands-on coding abilities in Python.
- β Python Functions (definition, arguments, return values)
- β Iterators & Iterables
- β Generators & Lazy Evaluation
- β Lambda Expressions
- β
Functional Programming (
map()
,reduce()
,filter()
) - β Problem Solving with DSA Concepts
- β Encapsulation & Polymorphism Basics
- β Writing Clean, Modular, and Reusable Code
- What is the difference between a function and a method in Python?
- Explain the concept of function arguments and parameters in Python.
- What are the different ways to define and call a function in Python?
- What is the purpose of the
return
statement in a Python function? - What are iterators in Python and how do they differ from iterables?
- Explain the concept of generators in Python and how they are defined.
- What are the advantages of using generators over regular functions?
- What is a lambda function in Python and when is it typically used?
- Explain the purpose and usage of the
map()
function in Python. - What is the difference between
map()
,reduce()
, andfilter()
functions in Python? - Using pen & paper write the internal mechanism for
reduce()
function on this list:[47, 11, 42, 13]
.
- Write a Python function that takes a list of numbers as input and returns the sum of all even numbers in the list.
- Create a Python function that accepts a string and returns the reverse of that string.
- Implement a Python function that takes a list of integers and returns a new list containing the squares of each number.
- Write a Python function that checks if a given number is prime or not from 1 to 200.
- Create an iterator class in Python that generates the Fibonacci sequence up to a specified number of terms.
- Write a generator function in Python that yields the powers of 2 up to a given exponent.
- Implement a generator function that reads a file line by line and yields each line as a string.
- Use a lambda function in Python to sort a list of tuples based on the second element of each tuple.
- Write a Python program that uses
map()
to convert a list of temperatures from Celsius to Fahrenheit. - Create a Python program that uses
filter()
to remove all the vowels from a given string. - Imagine an accounting routine used in a book shop. Write a Python program, which returns a list with 2-tuples. Each tuple consists of the order number and the product of the price per item and the quantity. The product should be increased by β¬10 if the value of the order is smaller than β¬100. Write the program using lambda and map.