# python-program

## Python program to remove duplicate characters from a string

In these programs, we will learn how to remove all the duplicate characters from a given string. To understand these codes, you must have the knowledge of the following topics in python: Strings Loops join and append functions ‘in’ and ‘not in’ keywords program 1(Without any inbuilt function) inputstr = …

## Python program to reverse the words in a string

In this program, we will learn how to reverse the words in a given string. To understand this, you must have knowledge of the following topics in python:- String Loops Split and join function Step Argument Program 1(By using a while loop) str= "I like to read" print("The given string …

## Python Program to find Simple Interest

This is a Python program to find the simple interest for a principal amount at a given rate for a given time. Simple Interest is given by the following formula S.I. = (P * R * T)/100 Where S.I. stands for Simple Interest, P for Principal, R for rate and …

## Python program to make a calculator

This is a python program to make a calculator. We simply take two numbers and a choice of operation from the user and display the output. To understand this example, you should have the knowledge of following topics in Python- User input Conditional Statements. User defined functions. Lets get started! …

## Python program to find square root of a number

In this program, we will calculate the square root of a number by writing some code in python. Square root of a number is a number that when multiplied by itself results in the original number. For example Square root of 9 is 3 because 3 * 3 = 9 …

## Python program to reverse a string

In this program we shall learn how to invert a string. For example if there is a string ‘hello’. The result should be ‘olleh’. To understand this example you should have knowledge of following topics in python – Strings Loops Looping through a string Program word = "apple" print("Given word …

## Python program to find string length

In this program we will learn how to calculate the number of characters in a word (or a string). To understand this program, you should have the knowledge of following topics in python Strings for in loop program   In this program, we are allowing a user to enter his/her …

## Python program to check prime number

In this example, we will make a program that will check whether a number entered by a user is prime or not. A prime number is one which can only be divided by 1 and itself. For example 7, 13, 19, 23 etc. All these number can only be divided by …

## Python program to display multiplication table

In this program we will learn how to display the multiplication table of a number entered by a user. For example if the user enters 7, then the output should be – 7 * 1 = 7 7 * 2 = 14 7 * 3 = 21 7 * 4 …

## Python program to find the sum of n natural numbers

In this program we will learn how to calculate the sum of natural numbers from 1 to the number that the user enters. For example if the user enters 5, the output would be 15, i.e., 1 + 2 + 3 + 4 + 5 To understand this example, you …