Skip to content

Devarsh23/Python-Tools-and-functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Python-Tools-and-functions

This repository describe the use fullness of python language with code of its user friendly functions Notable python function which makes the python programming language over the edge for problem solving Python the programming language termed as the language to be the most effective language in the upcoming due to its massive open source support. Python comes with plenty of useful functions and tools which makes the task of any developer very easy so in this article I am going to discuss such function. 1.Counter :- The counter is a specific function which is needed to import from the Collections module. It returns with the dictionary which sights the occurrence of the particular element in iterable. Most_common method of counter returns the most common occurrence elements.

2.itertools :- The most discuss tools in the python programming language is itertools it comes with the tremendous scope with can go through the combination and permutation of any iterable. Itertools generally returns the itrators which we need to handle specifically.

3.enumerate:- Enumerate function can help in the for loop where there is a need for index with the iterable element 4.zip :- When there is a need to combine each respective elements of two or more iterable the zip fuction is used it takes two or more iterable as argument 5.map:- When you need to apply any particular function to each and every element of the iterable then map function is used 6.filter:- This works similar to the map function buts it includes conditional facility

7.dict This can be considered as a boon to a object oriented developer in python it gives the information of all the instance attribute in the dictionary form 8.namedtuples:- If you need to access the tuples in the dictionary form where you can provide a key to search in tuple the named tuples is a best way to do it. 9.sorted:- Sorted is a sorted function mainly used for non inplace sorting by keeping reverse =TRUE we can sort in the reverse order .By the help of the key parameter we can sort through the inner elements like we can sort according to the tuples 2nd index in a data structure congaing various tuples inside list 10 min max with key Min and max function in the list are simply used to fetch the minimum and maximum from the iterable but with the help of the key function we can extract min and max according to the situation specific 11.defaultdict:- We need to import default dict from the collection module here it is similar data structure as the dictionary but if we request the key which is not present in the dictionary then it does not return key error but it returns none

12.Re library (Regular expression):- Regular expression is very important with respect to the text processing so python comes with re library for these purpose The basic idea behind the this is to create the pattern and then fire the query to search that pattern in string.
13.lambda function:- This function is also called as the anonyms function this function has no name it takes the parameter and returns the result with in one line of the code. Specifically, it is used to define the key for Sorted and like functions 14.Decorator Decorators provides the developer the power to change or add the function some line of code without even changing the source code of the function @keyword is placed above the function which needs to be decorated. 15.Generator Generator are the iterators which helps to use instantiate data rather than using whole data. This task prevents the system from loading whole data instead it loads the only required portion. 16.*args:- When we need to pass any no of arguments to the function then we define function parameter as *args this takes any no of arguments and converts it in to the tuple 17**kwargs When we need to pass dictionary type data structure arguments to the function then we define function parameter as **kwargs this takes dictionary type data structure as a arguments and converts it in to the pure dictionary

18.Use sets to remove the duplicate values from the list or any suitable iterable

19.all function All function returns true if all the value of the list is true 20.any function Any function returns true if any of the value of the list is true

About

This repository describe the use fullness of python language with code of its user friendly functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published