-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmax_num.py
More file actions
33 lines (22 loc) · 716 Bytes
/
max_num.py
File metadata and controls
33 lines (22 loc) · 716 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
32
33
# Write a Python function called max_num()to find the Max of three numbers.
# max_num ----------------------------------------------------------
def max_num(a,b,c):
return max([a,b,c])
print(max_num(1,2,3))
print(max_num(300,200,100))
print(max_num(2000,3000,1000))
# min_num ----------------------------------------------------------
def min_num(a,b,c):
return min([a,b,c])
print(min_num(1,2,3))
print(min_num(300,200,100))
print(min_num(2000,3000,1000))
#average number ----------------------------------------------------
a_list = [100, 200, 300]
sum = sum(a_list)
# Get total sum of `a_list`
length = len(a_list)
# Get the length of `a_list`
average = sum/length
# Calculate average
print(average)