- Palindrome Program In Python
- Factorial Program In Python
- Fibonacci Series Program In Python
- Armstrong Number Program In Python
- Calculator Program In Python
- Patterns Program In Python
- Leap Year Program In Python
- Prime Number Program In Python
- Program To Find Area In Python
- Program To Reverse A List In Python

**Palindrome Program In Python**

def pal(num): x1 = num[::-1] if x1 == x: print('palindrome') else: print('not a palindrome') print(pal('edureka'))

**Factorial Program In Python**

Factorial of a number is the product of all the positive numbers less than or equal to the number. The factorial of a number n is denoted by n!.

Following is the program to find the factorial of a number.

def fact(num): if num == 0: return num else: return num * fact(num - 1) print(fact(5))

**Fibonacci Series Program In Python**

Following is a program to print a fibonacci series.

a = int(input('enter the first element')) b = int(input('enter the second element')) n = int(input('enter the number of elements ')) print(a,b, end=" ") while n-2: c = a + b a = b b = c print(c, end=" ") n = n-1

**Armstrong Number Program In Python**

It is a special number, If we sum the cube of each of the digits in an armstrong number it will be equal to the number itself.

Following is the python program to check whether a number is an armstrong number or not.

num = int(input('enter the nuber')) s = 0 temp = num while temp > 0: c = temp % 10 s += c**3 temp //= 10 if temp == num: print('armstrong number') else: print('not an armstrong number')

**Calculator Program In Python**

Following is the program to create a calculator in python

def add(a,b): return a+b def sub(a,b): return a-b def prod(a,b): return a * b def div(a,b): return a / b def si(p, r, t): return (p*r*t) / 100 def ci(p, r ,t): return p * pow((1 + r/100), t) def sqr(num): return num**2 def sqrt(num) return num**0.5 print(add(10,15)) #to add two numbers, similarly you can use other functions for other operations.

**Patterns Program In Python**

Following is the program for patterns in python.

num = 5 a = (2 * num) - 2 for i in range(0, num): for j in range(0, a ): print(end=" ") for j in range(0, i+1) print('*' , end=" ") print(" ")

**Leap Year Program In Python**

Following is the program to check if a year is a leap year

year = int(input('enter year')) if year % 400 == 0: print('it is a leap year') elif year % 4 == 0: print('it is a leap year') elif year % 100 == 0: print('not a leap year') else: print('not a leap year')

**Prime Number Program In Python**

num = int(input('enter number')) for i range(2, num): if num% i == 0: print('not a prime number") break else: print('prime number') break

**Program To Print Areas In Python**

We will take the following shapes and try to calculate the area of all these shapes in python.

Following is the program to calculate areas in python

import math pi = math.pi def circle(radius): return pi * radius**2 def cube(side): return side**3 def cylinder(radius, height): return 2*pi*radius + 2*pi*height def sphere(radius): return 2*pi*(radius**2) print(circle(10)) #You can use other functions to calculate the areas of other shapes.

Following is the program to reverse a list

a = [1,2,3,4,5,6,7,8,9,10] print(a[: : -1]) #this will print the list in reverse.

*have any questions? mention them in the comments, we will get back to you.*