-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_Tutorial_6c.py
More file actions
31 lines (22 loc) · 944 Bytes
/
Python_Tutorial_6c.py
File metadata and controls
31 lines (22 loc) · 944 Bytes
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
# def a func which takes two no as i/p and return greater of two no.
x, y = input("Enter two numbers separated by comma: ").split(",")
def is_greater(x,y): #ALTERNATE
if(x>y): #def is_greater(x,y):
return x #print(max(x,y))
return y
print(is_greater(x,y)) #print(is_greater(x,y))
# def a func which takes three no as i/p and return greater of three no.
x, y, z = input("Enter three numbers separated by comma: ").split(",")
def is_greatest(x,y,z):
if (x>y) and (x>z):
print(f"{x} is greatest among {x},{y},{z}")
elif (y>z) and (y>x):
print(f"{y} is greatest among {x},{y},{z}")
else:
print(f"{z} is greatest among {x},{y},{z}")
is_greatest(x,y,z)
#SHORTCUT
x, y, z = input("Enter three numbers separated by comma: ").split(",")
def is_greatest(x,y,z):
print(max(x,y,z))
is_greatest(x,y,z)