## Python String Startswith

In this Python string example, we will look into a string based function startswith(). This function takes a parameter and returns true if the given string starts with the supplied parameter. Syntax str.startswith(prefix_text,[start],[end]) Python String startswith – Example mystr=”Example String

## Python Square Root

Python math module deals with mathematical functions and calculations. Function sqrt() in math module is used to calculate the square root of a given number. The below example finds square root of number 36 using Python. The output will be

## Python Factorial – 3 Different Ways

In this post, we will see three different ways to find factorial using Python. Before we jump into Python code, let us look at the below example to understand what is factorial of a number. factorial of 5 (5!) =

## Python Counter – Example

Python counter is a collection where the elements are stored as keys and their count as values. Let us explore Python counter using some examples. Since it is part of collections, we have to make an import using counter. In

The inbuilt module CSV in Python has many methods that can deal with csv files. In this article we will see example of how to use Python to read csv files. The steps are pretty simple. Open the csv file

## How to find day of the week in Python?

Let us see how to find day of the week in Python, given a date. Date class has two functions weekday() and isoweekday(), returns the day of the week in integer format. Function weekday() considers Monday as “0” and Sunday

## Python Datetime

The datetime module in Python offers multiple classes and functions that deals with date and time information. In this Python datetime article, we will see how to extract some basic date and time information using Python. Python Datetime Example The

## Python – Read Input From Terminal (Stdin)

In this example, we will see how to read an input from user via terminal (stdin) using Python. Python has an inbuilt function named “input” to receive inputs from the terminal. This function also takes an optional parameter which displays

## Python Exponent

In this Python exponent tutorial, we will see how to perform exponent operation. Other words, how to multiply a number to itself by “n” times. There are mainly two different ways to calculate exponent values. Using Operator ** Using function

## Python Function

What is a Python function? Python function is a block of code which has a specific name to it. Functions are generally used for reusability and modularity. We will talk about the below points related to Python functions in this