
Check for finite numbers in Python
Use the math module???s isfinite method to determine if a value is finite or not. If it is not a number, the function returns false. See below for an example:math.isfinite(10) returns True
Use the math module???s isfinite method to determine if a value is finite or not. If it is not a number, the function returns false. See below for an example:math.isfinite(10) returns True
At times, we want to run our code only if the version of Python engine is above a certain version. See below for sample code. Import sysversion = sys.version
Python can return multiple values at a time. See below for a simple example. def multipleValueFunc(): z = 11 b = 22 return z, b j,k = multipleValueFunc () print(j, k)
Use the rstrip method to return the string with all occurrences of the trailing characters removed. For e.g. inputString = “devxyyy”inputString.rstrip(???y???) gives ???devx???
Its pretty ease to reverse a string in Python. ???Devx Jan???[::-1] gives ???naJ xveD???