featured Image

Create Directory if not Exists in Python

In this article, we will see how to create a directory if the specified directory does not exist using python. In Python, we can create a directory/folder programmatically with the…

Read more
featured Image

Prepend List in Python (Append at the beginning)

In this article, we will learn how to prepend items in a list in Python. Python has an in-built method called append() to append (add at the end) items to…

Read more
featured Image

How to flatten nested list in python (5 ways)

A list in python is one of the most flexible data types. It can have multiple dimensions i.e it can contain lists inside a list. It is known as the…

Read more
featured Image

Square a number in Python (3 ways)

In this article, we will learn different ways to find the square of a number using different python methods and libraries. A square of a number is a number multiplied…

Read more
featured Image

Find square root of negative number using python

In this article, we will learn how to find the square root of a negative number using python. To find the square root of a negative number we have to…

Read more
featured Image

Save Python dict as JSON: Convert Dictionary to JSON

In this article, we will learn how to save a dictionary as JSON in python. While programming we need to work with lots of data. To store such data we…

Read more
featured Image

FileNotFoundError: No such file or directory Error Python

While working with files or directories, we sometimes come across the “No such file or directory” Error in our python program. The “FileNotFoundError: No such file or directory” error occurs…

Read more
featured Image

How to use Pi in Python? (math and numpy module)

In this article, we will learn about Pi in Python and how to use it in a python program. Pi (π) is a mathematical constant that is defined as the…

Read more
featured Image

Python import module from parent directory

In this article, we will learn ways to import modules from the parent directory in python. Python has lots of in-built modules to import methods and functions to add functionalities…

Read more