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 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)
- 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”
Top comments (0)