DEV Community

KAPIL SHAH
KAPIL SHAH

Posted on

1

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

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]
Enter fullscreen mode Exit fullscreen mode

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]
Enter fullscreen mode Exit fullscreen mode

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”

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay