Skip to content

anudeepsharma117/Python_Function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Python Functions

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.


πŸ“Œ Skills Covered

  • βœ… 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

πŸ“ Theory Questions

  1. What is the difference between a function and a method in Python?
  2. Explain the concept of function arguments and parameters in Python.
  3. What are the different ways to define and call a function in Python?
  4. What is the purpose of the return statement in a Python function?
  5. What are iterators in Python and how do they differ from iterables?
  6. Explain the concept of generators in Python and how they are defined.
  7. What are the advantages of using generators over regular functions?
  8. What is a lambda function in Python and when is it typically used?
  9. Explain the purpose and usage of the map() function in Python.
  10. What is the difference between map(), reduce(), and filter() functions in Python?
  11. Using pen & paper write the internal mechanism for reduce() function on this list: [47, 11, 42, 13].

πŸ’» Practical Questions

  1. Write a Python function that takes a list of numbers as input and returns the sum of all even numbers in the list.
  2. Create a Python function that accepts a string and returns the reverse of that string.
  3. Implement a Python function that takes a list of integers and returns a new list containing the squares of each number.
  4. Write a Python function that checks if a given number is prime or not from 1 to 200.
  5. Create an iterator class in Python that generates the Fibonacci sequence up to a specified number of terms.
  6. Write a generator function in Python that yields the powers of 2 up to a given exponent.
  7. Implement a generator function that reads a file line by line and yields each line as a string.
  8. Use a lambda function in Python to sort a list of tuples based on the second element of each tuple.
  9. Write a Python program that uses map() to convert a list of temperatures from Celsius to Fahrenheit.
  10. Create a Python program that uses filter() to remove all the vowels from a given string.
  11. 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.

πŸ“‚ Repository Structure

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published