Posts

Showing posts from October, 2021

PYTHON NOTES

Image
cmath is a mathematical module that is present in python to convert complex numbers to polar numbers Doubt:  why we use * in cmath as *cmath need to know this (it is raised in polar coordinates problem hacker rank)                       we use * because it clears the brackets and take the input from spaces of lists rpartition() function in Python  split the given string into three parts . rpartition() start looking for separator from right side, till the separator is found and return a tuple which contains part of the string before the separator, the argument of the string, and the part after the separator   In Python 3 we use // for integer division Since set elements must be hashable, and lists are considered mutable,  you cannot add a list to a set . Try Except in Python The try block is  used to check some code for errors  i.e the code inside the try block will execute when there is no error in the program. Whereas the code inside the except block will execute whenever the program