uz
Feedback

Firibgarlarga uchmang! Telemetrio bunday kanallarni topadi va belgilaydi 👉 Belgini ko‘rmoqchi bo‘lsangiz, obuna bo‘ling

Free Python Course

Free Python Course

Kanalga Telegram’da o‘tish
5 967
Obunachilar
Ma'lumot yo'q24 soatlar
-357 kun
-22530 kun
Postlar arxiv
ANY FUNCTION Any Returns true if any of the items is True. It returns False if empty or all are false. Any can be thought of as a sequence of OR operations on the provided iterables. It short circuit the execution i.e. stop the execution as soon as the result is known.

ZIP FUNCTION EXAMPLE 2 list_1 = ['User','Age','Salary'] list_2 = ['Rushi',19,28000] Converting Zip into a List data_return = list(zip(list_1,list_2)) print(data_return)

ZIP FUNCTION EXAMPLE 1 list_1 = ['User','Age','Salary'] list_2 = ['Rushi',19,28000] data_return = zip(list_1,list_2) print(data_return) Output <zip object at 0x0000008C0C985080>

ZIP FUNCTION SYNTAX zip(iterator1, iterator2, iterator3 .)

ZIP FUNCTION The zip() function returns a zip object, which is an iterator of tuples where the first item in each passed iterator is paired together, and then the second item in each passed iterator are paired together etc. If the passed iterators have different lengths, the iterator with the least items decides the length of the new iterator.

MAP FUNCTION EXAMPLE def addition(n) : return n + n numbers = (1, 2, 3, 4) result = map(addition, numbers) print(list(result)) Output [2, 4, 6, 8]

fun : It is a function to which map passes each element of given iterable. iter : It is a iterable which is to be mapped. NOTE : You can pass one or more iterable to the map() function.

MAP FUNCTION SYNTAX map(fun, iter)

MAP FUNCTION map() function returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable (list, tuple etc.)

WHY USE LAMBDA FUNCTION ? You should use the lambda function to create simple expressions. For example, expressions that do not include complex structures such as if-else, for-loops, and so on. So, for example, if you want to create a function with a for-loop, you should use a user-defined function.

EXAMPLE :
EXAMPLE :

LAMBDA EXPRESSION SYNTAX lambda arguments : expression

LAMBDA EXPRESSION A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression. argument(s) is a placeholder, that is a variable that will be used to hold the value you want to pass into the function expression. A lambda function can have multiple variables depending on what you want to achieve.

**KWARGS EXAMPLE 2 : In this case, positional arguments are collected into a tuple args, and keyword arguments are collected
**KWARGS EXAMPLE 2 : In this case, positional arguments are collected into a tuple args, and keyword arguments are collected into a dictionary kwargs

You can also use both args and kwargs together in a function definition, like this:

**KWARGS EXAMPLE 1 :
**KWARGS EXAMPLE 1 :

**KWARGS kwargs is a dictionary of keyword arguments, which allows you to pass a variable number of keyword arguments to a function. The syntax for keyword arguments is name=value. For example:

*ARGS EXAMPLE :
*ARGS EXAMPLE :

*ARGS args is a tuple of positional arguments, which means that you can pass an arbitrary number of arguments to a function, and they will be collected into a tuple. For example:

*ARGS AND **KWARGS IN PYTHON In Python, args and kwargs are used to pass a variable number of arguments to a function.