Skip to content

Commit 66319fa

Browse files
committed
Simple Function
1 parent 9c2c3ce commit 66319fa

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Function/1.BasicOfFunction.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#function procedure when we need to do some task then the best way to reuse our code
2+
# so function can help
3+
#Function or procedure syntax def functionname(variabl1,variable2..):
4+
# return calculation
5+
#to define a function def keyword is used
6+
7+
#addition function
8+
def addition(a,b):
9+
return a+b
10+
11+
def substraction(a,b):
12+
return a-b
13+
14+
def multiply(a,b):
15+
return a*b
16+
17+
print("Addtion is ")
18+
print(addition(19,8)) #calling a function
19+
20+
print("Substraction is ")
21+
print(substraction(19,8)) #calling substraction function
22+
23+
print("Multiplication is ")
24+
print(multiply(19,8)) #calling multiplication function
25+
26+
x=input("Enter First Number:")
27+
y=input("Enter Second Number:")
28+
z=(addition(int(x),int(y))) #sending user input function
29+
print("Your Answer")
30+
print(z)

0 commit comments

Comments
 (0)