Python Unknown (Tips and Tricks) — Part 3

Python features, tips, and tricks which are less — known.

HarshAditya_Gaur
1 min readFeb 6, 2022
Python Hidden

In continuation of the previous section, here are some more techniques to apply in competitive programming and problem solving.

Note — All features are tried and tested on python v3.8 (Anaconda3)

Python setattr() function - This function is an another approach to assign value to the attribute of an object.

Syntax : setattr(object, attribute, value)

Python ord() function - This function returns the unique number associated to the Unicode code of the character passed as an argument.

Python staticmethod() function - This function returns a static method for a function passed as the parameter.

Python zip() function - This function takes iterable and merges all of the values into a single iterator item. This function can have an indefinite number of arguments.

Syntax : zip(iterable_1, iterable_2, ….)

Python enumerate() function - This function takes an iterable and adds a counter to it before returning it as an enumerating object. This enumerated object can then be used in loops directly or further conversion can be done.

Syntax : enumerate(iterable, counter)

More such tips and trick for python v3, coming soon in part 4..!!

Thank You..!! :)

--

--