Latest Posts From Vijaykrishna Ram

Python – Check if Variable is a String

Since Python does not support static type checking (i.e type checking at compile type), if you ever want to check if a Python variable or object is a String or not; we need to use certain methods. Let us understand some of the ways of checking for a string type object. 1. Using isinstance() method […]

Python Complex Numbers

A Complex Number is any number of the form a + bj, where a and b are real numbers, and j*j = -1. In Python, there are multiple ways to create such a Complex Number. Create a Complex Number in Python We can directly use the syntax a + bj to create a Complex Number. […]

Python Custom Exceptions

An Exception is raised whenever there is an error encountered, and it signifies that something went wrong with the program. By default, there are many exceptions that the language defines for us, such as TypeError when the wrong type is passed. In this article, we shall look at how we can create our own Custom […]

Python setattr() Function

Python setattr() function is used to set the attribute of an object, given its name. While being a very simple function, it can prove to be very useful in the context of Object Oriented Programming in Python. Let us look at how we could use this function in our Python programs. setattr() Function Syntax It […]

Python Template Strings

Python’s Template String Class provides a way for simple string substitution, wherein the template fields are substituted with suitable replacement strings provided by the user. Sometimes, it may be a preference to have an easier to replace string, rather than using other format strings for substitution. Template Strings are used exactly for this purpose, to […]

Python // operator – Floor Based Division

The // operator in Python 3 is used to perform floor-based division. This means that a // b first divides a by b and gets the integer quotient, while discarding the remainder. This means that the result of a//b is always an integer. Python // Operator Examples Here are a few examples to illustrate the […]