Python break Statement Tutorial

Python break Statement Tutorial

Python break statement is used to stop current code flow and change to the upper flow. The break statement is generally used with loop statements in order to stop current code flow. Alternatively break statement can be used for other cases like in functions. In this tutorial we examine how to use Python break statement … Read more

Python abs() Method Tutorial

Python abs() Method Tutorial

Python provides the abs() as a built-in method to calculate the absolute value of a number. The number can be an integer, floating-point, etc. The absolute value is providing the positive value of the specified number event it is a negative number. abs() Method Syntax The abs() method has the following syntax. The abs() method … Read more

Python Compare Strings

Python Compare Strings

Python provides the equal “==” and not equal “!=” operators in order to compare strings that can be a string value or string variable. The comparison results boolean values True or False according to the situations. Check If String Variables Are Equal The equality operator == can be used to check if the provided string … Read more

Check Type with type() and isinstance() Methods In Python

Check Type with type() and isinstance() Methods In Python

Python programming language provides different built-in types like an object, list, dictionary, integer, string, etc. It can be very handy to check types and compare different variable types. There are two popular methods called type() and isinstance(). These methods can be used to check specified object and variable types and make decisions according to the … Read more

How To Calculate The Natural Logarithm (ln) In Python?

How To Calculate The Natural Logarithm (ln) In Python?

The natural logarithm of a number can be calculated by using different modules in Python. The numpy module provides the log() method in order to calculate the natural logarithm. Also, the Pytyhon math library provides the log() method in order to calculate natural logarithm too. Calculate Natural Logarithm with math.log() The math module is provided … Read more

“python2 -m SimpleHTTPServer” Equivalent For Python3

"python2 -m SimpleHTTPServer" Equivalent For Python3

Python2 provides the SimpleHTTPServer module to create a basic HTTP server in the specified folder. The SimpleHTTPServer module is very useful for basic operations like testing, development, learning, etc. The SimpleHTTP server provides a built-in module and there is no need for an installation. With Python3 this SimpleHTTPServer is implemented as “http.server” which is provided … Read more