Function Python _
Function Python _
A Function is a set of statements that take input, do some specific computation and produces
output.
Example:
def is a key word to use define a function
How to Define a function:
def fn():
print(“Hello”)
How to call Function:
fn()
Declaration of variables :
Local :Only Function can access
Global : Every function can access
def cal():
c=a+b
def prime(x):
c=0
for i in range(1,x+1):
if(x%i==0):
c=c+1
def get():
print("Enter Number :")
a=int(input())
prime(a)
The vari, a dec. As local . To access a from prime we hv. To pass .when we r passing
Actual arg and in the function def. Called formal arg.
• Using function
• def check(a) and def d_input()
• Write the following prog:
• Input a number check Armstrong or not
• Input a number check pal or not
• Input a number check perfect number or not
• Input a number check automorphic number or
not
• Input a string check is it pal or not