Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is a Lambda form? Explain about assert statement?

Answer Posted / chaitanya

The lambda form:

Using lambda keyword tiny anonymous functions can be created.

It is a very powerful feature of Python which declares a one-line unknown small function on the fly. The lambda is used to create new function objects and then return them at runtime.

The general format for lambda form is:

lambda parameter(s): expression using the parameter(s)

For instance k is lambda function-

>>> k= lambda y: y + y

>>> k(30)

60

>>> k(40)

80

The assert statement:

The build-in assert statement of python introduced in version 1.5 is used to assert that something is true.

Programmers often place assertions at the beginning of a function to check for valid input, and after function call to check for valid output. Assert statement can be removed after testing of program is over.

If assert evaluates to be false, an AssertionError exception is raised. AssertionError exceptions can be handled with the try-except statement.

The general syntax for assert statement is:

assert Expression[, Arguments]

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the differences between the threading and multiprocessing in python?

942


Why python is best for data science?

992


What is rdd in python?

798


What tuple means?

808


How do you write a simple code in python?

841


Has python has monkey patching concept within?

891


What is unboundlocalerror in python?

909


How would you achieve web scraping in python?

855


Do you know how memory is managed in python?

918


Why does comparing strings in python using either ‘==’ or ‘is’ sometimes produce a different result?

771


If while installing a package with pip, you get the error no matching installation found, what can you do?

880


How do you insert a line break in python?

853


Which methods/functions do we use to determine the type of instance and inheritance?

816


Mention the use of // operator in Python?

872


Tell me what's the process to get the home directory using ‘~' in python?

873