Day 19 of My AI & Data Mastery Journey: From Python to Generative AI

TODAY’S PROJECT

Function :-

Lambda Functions in Python
• Lambda: A small anonymous function defined with the lambda keyword instead of def.
• Syntax: lambda arguments: expression
• Lambdas are used for short, throwaway functions, especial…


This content originally appeared on DEV Community and was authored by Nitin-bhatt46

TODAY’S PROJECT

Function :-

Lambda Functions in Python
• Lambda: A small anonymous function defined with the lambda keyword instead of def.
• Syntax: lambda arguments: expression
• Lambdas are used for short, throwaway functions, especially as arguments to functions like map() and filter().

Pseudo Code for Squaring a Number Using Lambda

  1. Start
  2. Define an anonymous function that receives one argument: • Multiply the argument by itself
  3. Call this function with input 5
  4. Print the result (should be 25)
  5. End

map() Function
• Purpose: Applies a function to every element in an iterable (like a list) and returns a map object (iterator).
• Syntax: map(function, iterable)
• Used when you want to transform all elements in a list (or iterable).

Pseudo Code for Doubling Each Number

  1. Start
  2. Create a list of numbers Example: numbers =
  3. For each element in the list: • Multiply the element by 2 • Store the result in a new list
  4. Print the new list of doubled numbers
  5. End

Pseudo Code for Finding Cubes

  1. Start
  2. Create a list of numbers Example: nums =
  3. For each element in the list: • Raise the element to the power of 3 • Store the result in a new list
  4. Print the new list of cubes
  5. End

filter() Function
• Purpose: Filters items out of an iterable for which the function (predicate) returns False.
• Syntax: filter(function, iterable)
• Used to keep elements that satisfy a condition.
• Example: Filter even numbers

Pseudo Code for Filtering Even Numbers

  1. Start
  2. Create a list of numbers (e.g., )
  3. For each number in the list: • If the number is divisible by 2 (i.e., number % 2 == 0): • Include the number in a new list of even numbers
  4. Print the list of even numbers
  5. End

Pseudo Code for Filtering Words with More Than 5 Letters

1.Start
2.Create a list of words (e.g., ["apple", "banana", "cherry", "kiwi"])
3.For each word in the list:
• If the length of the word is greater than 5:
• Include the word in a new list of long words
4.Print the list of long words
5.End


This content originally appeared on DEV Community and was authored by Nitin-bhatt46


Print Share Comment Cite Upload Translate Updates
APA

Nitin-bhatt46 | Sciencx (2025-10-30T05:09:21+00:00) Day 19 of My AI & Data Mastery Journey: From Python to Generative AI. Retrieved from https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/

MLA
" » Day 19 of My AI & Data Mastery Journey: From Python to Generative AI." Nitin-bhatt46 | Sciencx - Thursday October 30, 2025, https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/
HARVARD
Nitin-bhatt46 | Sciencx Thursday October 30, 2025 » Day 19 of My AI & Data Mastery Journey: From Python to Generative AI., viewed ,<https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/>
VANCOUVER
Nitin-bhatt46 | Sciencx - » Day 19 of My AI & Data Mastery Journey: From Python to Generative AI. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/
CHICAGO
" » Day 19 of My AI & Data Mastery Journey: From Python to Generative AI." Nitin-bhatt46 | Sciencx - Accessed . https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/
IEEE
" » Day 19 of My AI & Data Mastery Journey: From Python to Generative AI." Nitin-bhatt46 | Sciencx [Online]. Available: https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/. [Accessed: ]
rf:citation
» Day 19 of My AI & Data Mastery Journey: From Python to Generative AI | Nitin-bhatt46 | Sciencx | https://www.scien.cx/2025/10/30/day-19-of-my-ai-data-mastery-journey-from-python-to-generative-ai/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.