Posts Tagged with 'Python'

Python | Generator Functions that return an iterable set of items are called generators. It is a normal function except that it yields expression in the function. It does not implements __itr__ and next() method and …

Last updated 3 weeks, 5 days ago | 20 views

Tags:- Python

Python | strip() Function | Remove whitespaces from a string  To remove the whitespaces and trailing spaces from the string, Python provides a strip([str]) built-in function. This function returns a copy of the string after removing whitespaces …

Last updated 3 weeks, 5 days ago | 16 views

Tags:- Python

Python | swapcase() Function It is a string's function that converts all uppercase characters into lowercase and vice versa. It automatically ignores all the non-alphabetic characters.   string = "IT IS IN LOWERCASE." print(string.swapcase())  

Last updated 3 weeks, 5 days ago | 22 views

Tags:- Python

Python | zip() Function Python zip() function returns a zip object, which maps a similar index of multiple containers. It takes an iterable, converts it into an iterator, and aggregates the elements based on the iterable passed. …

Last updated 3 weeks, 5 days ago | 27 views

Tags:- Python

Python | Monkey Patching In Python, the term monkey patch only refers to dynamic modifications of a class or module at run-time.   # m.py class A: def fun(self): print("Hi") import m def monkey(self): print …

Last updated 3 weeks, 5 days ago | 40 views

Tags:- Python

Python | Pickling, and Unpickling The pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using the dump function, this process is called pickling. …

Last updated 3 weeks, 5 days ago | 16 views

Tags:- Python

A lambda function is a small anonymous function. This function can have any number of parameters but, can have just one statement.     Syntex:  lambda arguments : expression   a = lambda x,y : x+y print(a(5, 6)) It …

Last updated 3 weeks, 5 days ago | 18 views

Tags:- Python

Python | Main Function In the world of programming languages, the main is considered as an entry point of execution for a program. But in python, it is known that the interpreter serially interprets the file …

Last updated 3 weeks, 5 days ago | 21 views

Tags:- Python

Python | Deep and Shallow copies Shallow copy does the task of creating new objects and storing references to original elements. This does not undergo recursion to create copies of nested objects. It just copies the …

Last updated 3 weeks, 5 days ago | 19 views

Tags:- Python

Python | Generate random numbers Python provides a module called random using which we can generate random numbers. e.g: print(random.random())     We have to import a random module and call the random() method as shown …

Last updated 3 weeks, 5 days ago | 20 views

Tags:- Python

Python modules are the files having python code which can be functions, variables, or classes. These go by .py extension. The most commonly available built-in modules are: os math sys random re datetime JSON

Last updated 3 weeks, 5 days ago | 19 views

Tags:- Python

Python |  issubclass() This is done by using a method called issubclass() provided by python. The method tells us if any class is a child of another class by returning true or false accordingly.     …

Last updated 3 weeks, 5 days ago | 22 views

Tags:- Python

Finalize method is used for freeing up the unmanaged resources and cleaning up before the garbage collection method is invoked. This helps in performing memory management tasks.

Last updated 3 weeks, 5 days ago | 14 views

Tags:- Python

Python | New and Override Modifiers The new modifier is used to instruct the compiler to use the new implementation and not the base class function. The Override modifier is useful for overriding a base class …

Last updated 3 weeks, 5 days ago | 16 views

Tags:- Python

Negative numbers mean that you count from the right instead of the left. So, list[-1] refers to the last element, list[-2] is the second-last, and so on.

Last updated 3 weeks, 5 days ago | 18 views

Tags:- Python