Category Archives: Python Programming

Python Linear Search

Here you will get program for linear search in python. Linear search is one of the simplest searching algorithm in which targeted item in sequentially matched with each item in a list. It is worst searching algorithm with worst case time complexity O (n). Below is its implementation. Image Source Program for Python Linear Search… Read More »

Python Program to Check Palindrome Number

Here you will get python program to check palindrome number. A number is said to be palindrome if it is equal to its reverse. For example 121, 555, etc are palindrome while 124, 367, etc are not. Python Program to Check Palindrome Number

Output enter a number: 12321 number is palindrome Comment below if… Read More »

Python Program to Convert Decimal to Binary, Octal and Hexadecimal

Here you will get python program to convert decimal to binary, octal and hexadecimal. Python provides inbuilt functions for conversion of one number system to another. Convert decimal to binary using bin() function. In converted binary form 0b is present at the beginning. Convert decimal to octal using oct() function. In converted octal form 0o is present… Read More »

Python Program to Check Armstrong Number

Here you will get python program to check armstrong number. A number is said to be an armstrong number if sum of its digits raised to the power n is equal to itself. Here n is total digits in number. For example 370 is armstrong number. Here n = 3, so 33 + 73 + 03 = 27… Read More »

Python Program to Print Fibonacci Series

Here you will get python program to print fibonacci series using for loop. A series in which next term is obtained by adding previous two terms is called fibonacci series. For example 0, 1, 1, 2, 3, 5, 8 . . . . Python Program to Print Fibonacci Series

Output enter number of digits… Read More »

Python Program to Check Prime Number

Here you will get python program to check prime number. A number is called prime number if it is only divisible by 1 or itself. For example 2, 3, 5, 7, 11, etc are prime numbers. Below program takes a number as input and checks it is prime number or not. Python Program to Check… Read More »

Python Program to Find Factorial of Number Using Loop

Here you will get python program to find factorial of number using for and while loop. Factorial of a number is calculated by multiplying it with all the numbers below it starting from 1. For example factorial of 4 is 24 (1 x 2 x 3 x 4). Below program takes a number from user… Read More »

Python Program to Check Number is Odd or Even

Here you will get python program to check number is odd or even. A number is even if it is completely divisible by 2 otherwise it is odd. The modulus operator % is used to find remainder of any number. So here we will use it to divide a number by 2 and find the… Read More »

Python Program to Check Leap Year

Here you will get python program to check leap year. A normal year contains 366 days while a leap year contains 365 years. If the year is divisible by 4 then it is leap year except the century years (year that have 00 in end). A century year is leap year only if it is… Read More »

Python Program to Find Largest Among Three Numbers

Here you will get python program to find largest number among three numbers. The program will ask user to input three numbers and then print greatest among them.

Output enter three numbers: 12 7 9 12 is largest

Python Program to Swap Two Numbers

Here you will get python program to swap two numbers with and without using temporary variable. Python Program to Swap Two Numbers Using Temporary Variable

Output before swapping a= 10 b= 20 after swapping a= 20 b= 10 Python Program to Swap Two Numbers Without Using Temporary Variable Method 1: Python provides a way… Read More »

Python Program to Add Two Numbers

Here you will get python program to add two numbers. The program will first ask user to enter two numbers, calculate their sum and finally print it. input() is an inbuilt function which is used to take input from user. Python Program to Add Two Numbers

Output enter first number:5 enter second number:7 sum:… Read More »