You are on page 1of 1

# Function to display the message in the ouput

def display():
print("Stay Safe and Keeps Social Distancing")
for x in range(1,6):
display()

def Swap(name1,name2):
print("Name of Students Before Swapping")
print("First Student Name=",name1)
print("Second Student Name=",name2)
#swap the names
temp=name1
name1=name2
name2=temp
print("Name of Students After Swapping")
print("First Student Name=",name1)
print("Second Student Name=",name2)
Swap('Akhil','Amal')
print() # insert a line break
Swap('Harpreet','Haleemath')

# Write a function to calculate the factorial of a number(n) with return statement


# 1 * 2 * 3 * 4...............* n -----># fact=fact * value
def factorial(n):
fact=1
for x in range(1,n+1):
fact=fact * x
return fact
F=factorial(5)
print('The required factorial is =',F)
N=int(input('Enter the value for factorial='))
F=factorial(N)
print('The required factorial is =',F)

# demonstration of positional arguments(required)


def show(a,b,c,d):
print(a,b,c,d)
show(1,2,3,4) # 1(a) 2(b) 3(c) 4(d) are positional or required arguments

# demonstration of keyword arguments


def show(a,b,c,d):
print(a,b,c,d)
show(d=1,a=2,c=3,b=4)

You might also like