Day -04 of learning python(02-22-2025)

The things i learned form todays python course:

Lambda function:

It is one most important important function used in python programming.

on going depth i found that it is anonymous function used in code .It is mainly used in on line function for…


This content originally appeared on DEV Community and was authored by KAPIL SHAH

The things i learned form todays python course:

  1. Lambda function:

It is one most important important function used in python programming.

on going depth i found that it is anonymous function used in code .It is mainly used in on line function for example :

numbers = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x ** 2, numbers))
print(squared)  # Output: [1, 4, 9, 16, 25]

In above example list is given and in that list using lambda function we found the square of the whole list i.e in sqaured variable.

The basic idea used in above example or anyother example or program is used like :

lambda(parameter:expression)

or lambda(argumensts:expression)

  1. Map:

It helps to iterate every single value present in the list.

taking an example:

numbers = [1, 2, 3, 4, 5]
squared = list(map(lambda x: x ** 2, numbers))
print(squared)  # Output: [1, 4, 9, 16, 25]

In above example map is used for sqauring every single of the value in the list .

Also some basic stuffs like how swap values in the list ,more about IDctionary and all .

This much only for today.

“I AM BATMAN”


This content originally appeared on DEV Community and was authored by KAPIL SHAH


Print Share Comment Cite Upload Translate Updates
APA

KAPIL SHAH | Sciencx (2025-02-22T16:22:13+00:00) Day -04 of learning python(02-22-2025). Retrieved from https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/

MLA
" » Day -04 of learning python(02-22-2025)." KAPIL SHAH | Sciencx - Saturday February 22, 2025, https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/
HARVARD
KAPIL SHAH | Sciencx Saturday February 22, 2025 » Day -04 of learning python(02-22-2025)., viewed ,<https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/>
VANCOUVER
KAPIL SHAH | Sciencx - » Day -04 of learning python(02-22-2025). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/
CHICAGO
" » Day -04 of learning python(02-22-2025)." KAPIL SHAH | Sciencx - Accessed . https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/
IEEE
" » Day -04 of learning python(02-22-2025)." KAPIL SHAH | Sciencx [Online]. Available: https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/. [Accessed: ]
rf:citation
» Day -04 of learning python(02-22-2025) | KAPIL SHAH | Sciencx | https://www.scien.cx/2025/02/22/day-04-of-learning-python02-22-2025/ |

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.