About Lesson
1. wap to print “Hello world” & your name using function.
2. wap to find addition of two number using functions.
def add(): a=int(input(“Enter first number “)) b=int(input(“Enter second number “)) c=a+b print(“Addition is= “,c) add() |
3. wap to check entered number is even number or odd number using function
def ch(): n=int(input(“Enter any number “)) if n%2==0: print(“Even No”) else: print(“Odd No.”) ch() |
4. wap to find factorial of any number using function
def fact(): n=int(input(“Enter any number “)) fact=1 while n>0: fact=fact*n n=n-1 print(“Factorial is : “,fact) fact() |