Category Archives: Python

Keywords in Python | Set 1

Python Keywords – Introduction This article aims at providing a detailed insight to these keywords. 1. True : This keyword is used to represent a boolean true. If a statement is truth, “True” is printed. 2. False : This keyword is used to represent a boolean false. If a statement is False, “False” is printed.… Read More »

Timeit in Python with Examples

This article will introduce you to a method of measuring the execution time of your python code snippets. We will be using an in-built python library timeit. This module provides a simple way to find the execution time of small bits of Python code. Why timeit? Well, how about using simple time module? Just save… Read More »

Command Line Interface Programming in Python

This article discusses how you can create a CLI for your python programs using an example in which we make a basic “text file manager”. Let us discuss some basics first. What is a Command Line Interface(CLI)? A command-line interface or command language interpreter (CLI), also known as command-line user interface, console user interface, and… Read More »

Operator Functions in Python | Set 2

Operator Functions in Python | Set 1 More functions are discussed in this article. 1. setitem(ob, pos, val) :- This function is used to assign the value at a particular position in the container. Operation – ob[pos] = val 2. delitem(ob, pos) :- This function is used to delete the value at a particular position… Read More »

Data analysis and Visualization with Python

Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric Python packages. Pandas is one of those packages, and makes importing and analyzing data much easier. In this article, I have used Pandas to analyze data on Country Data.csv file from UN public Data Sets of a popular… Read More »

How to check if a string is a valid keyword in Python?

Defining a Keyword In programming, a keyword is a “reserved word” by the language which convey a special meaning to the interpreter. It may be a command or a parameter. Keywords cannot be used as a variable name in the program snippet. Keywords in Python:  Python language also reserves some of keywords that convey special… Read More »

Type Conversion in Python

Python defines type conversion functions to directly convert one data type to another which is useful in day to day and competitive programming. This article is aimed at providing the information about certain conversion functions. 1. int(a,base) : This function converts any data type to integer. ‘Base’ specifies the base in which string is if… Read More »

Graph Plotting in Python | Set 2

Graph Plotting in Python | Set 1  Subplots Subplots are required when we want to show two or more plots in same figure. We can do it in two ways using two slightly different methods. Method 1 Output: Let us go through this program step by step:‘fivethirtyeight’) The styling of plots can be configured… Read More »

Python | sep parameter in print()

The separator between the arguments to print() function in Python is space by default (softspace feature) , which can be modified and can be made to any character, integer or string as per our choice. The ‘sep’ parameter is used to achieve the same, it is found only in python 3.x or later. It is… Read More »

Output of Python program | Set 5

Predict the output of the following programs: Program 1: Output: cool Explanation: There is a docstring defined for this method, by putting a string on the first line after the start of the function definition. The docstring can be referenced using the __doc__ attribute of the function. And hence it prints the indexed string. Program… Read More »

Working with zip files in Python

This article explains how one can perform various operations on a zip file using a simple python program. What is a zip file? ZIP is an archive file format that supports lossless data compression. By lossless compression, we mean that the compression algorithm allows the original data to be perfectly reconstructed from the compressed data.… Read More »