Python program to calculate the simple interest using user provided values : In this tutorial, we will learn how to calculate simple interest in python using the values entered. The following formula is used to calculate simple interest value : SI = (P x N x R)/100 Where, P = Principal amount N = Time to […]

# python

## Python example program to split a string at linebreak using splitlines

Python split a string at linebreak using splitlines() : splitlines() function is used to split a string at line breaks. It returns the list of all lines in the given string. This method takes one parameter. If the parameter is True, line breaks will be included in the result list. Else, line breaks will not […]

## Python swap case of each character of a string

Python swap case of each character of a string : Python provides one inbuilt method called swapcase() to swap all characters of a string. It swaps the uppercase characters to lowercase, lowercase characters to uppercase in a string and returns the string. Definition : The swapcase method is defined as below : str.swapcase() It returns […]

## How to remove an item from a list in python

How to remove an item from a python list : In this tutorial, we will learn how to remove an item from a list in python. We will learn how to remove an element using its value from a list and how to remove using an index. Also, we will learn how to remove all […]

## Convert string to float in python

Convert string to float in python : Sometimes, we need to convert a string to a float value. For example, if you are receiving float data in string format from the server and if you want to do any arithmetic operations on them, you need to convert them to float first. For example, let’s take […]

## Python Set intersection example

Python Set intersection example : Intersection is used to find out the common elements between two Sets. Symbol ‘∩’ is used to denote intersection. For example : A = {1,2,3,4,5} B = {2,3,7} A∩B = {2,3} In the above example, we have two Set A and B and we are finding out the intersection between […]

## Find out the multiplication of two numbers in Python

Find out the multiplication of two numbers in Python : In this tutorial, we will learn how to find out the multiplication of two numbers in python. The program will ask the user to enter the numbers and then it will calculate the multiplication of the numbers. Finally, it will print out the multiplication result. […]

## Python translate method

Python translate() method : translate() method, as its name suggests, used to translate a string. Or, this is used to replace a set of characters with a different set of characters in a string. Both of the character set is mapped using a table. For creating the mapping table, one function maketrans() is used. The […]

## Python raw strings : Explanation with examples

Raw strings in python: Explanation with examples : raw strings are raw string literals that treat backslash (\) as a literal character. For example, if we try to print a string with a “\n” inside, it will add one line break. But if we mark it as a raw string, it will simply print out […]

## Convert an integer or float to hex in Python

Convert an integer or float to hex in Python : In this tutorial, we will learn how to find out the hex value of an integer or floating value in python. Using hex() method : Method hex() is used to find out the hex value of an integer number. The syntax of this method is […]