-
Notifications
You must be signed in to change notification settings - Fork 0
/
functioninput.py
33 lines (23 loc) · 1006 Bytes
/
functioninput.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def add_function(): #when you want to take input in a function you dont give parameters/ arguements to it
num1 = int(input("enter number 1:"))
num2 = int(input("enter number 2:"))
c = num1 + num2
print(c)
add_function()
# return value - this keyword deliveres the output but does not print it
def function2():
number1 = int(input("enter number 1: "))
number2 = int(input("enter number 2: "))
a = number1 + number2
return a
A = function2() #after using the return keyword, it is impontant to assign the function to a variable when calling it
print(A)
#you can return multiple values at the same time
def function2():
number1 = int(input("enter number 1: "))
number2 = int(input("enter number 2: "))
a = number1 + number2
b = number1 - number2
return a,b
A,B = function2() #after using the return keyword, it is impontant to assign the function to a variable when calling it
print(A,B)