0% found this document useful (0 votes)
0 views

Function Python _

The document explains the concept of functions in Python, including how to define and call them. It covers local and global variable declarations, and provides examples of functions for input and calculations. Additionally, it suggests writing programs to check various mathematical properties of numbers and strings.

Uploaded by

tutor nag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Function Python _

The document explains the concept of functions in Python, including how to define and call them. It covers local and global variable declarations, and provides examples of functions for input and calculations. Additionally, it suggests writing programs to check various mathematical properties of numbers and strings.

Uploaded by

tutor nag
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 4

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 <fun name>(<list of para>):


a=0
b=0
c=0
def dinput():
global a
global b
print("Enter Number 1 :")
a=int(input())
print("Enter Number 2 :")
b=int(input())

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

You might also like