Latest Posts From Vijaykrishna Ram

Python – Catch Multiple Exceptions

Python always operates on an Exception based model. That is, any errors during the program execution are passed as Exceptions and returned to the programmer, which may be handled accordingly using Exception Handling techniques. Sometimes, it is possible that a process raises more than one possible exception, depending on the flow of control. Thus, we […]

Python – stdin, stdout, and stderr

Before going through this article, let us understand what the terms stdin, stdout and stderr are. Standard input – This is the file-handle that a user program reads to get information from the user. We give input to the standard input (stdin). Standard output – The user program writes normal information to this file-handle. The […]

Python encode() and decode() Functions

Python’s encode and decode methods are used to encode and decode the input string, using a given encoding. Let us look at these two functions in detail in this article. Encode a given String We use the encode() method on the input string, which every string object has. Format: This encodes input_string using encoding, where […]

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 […]