Skip to content

Commit 2c41295

Browse files
committed
how to use functions with python to beginners
1 parent 696711e commit 2c41295

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ Feel free to add basic python scripts/programs that helped you learn python. I h
3232
15. [print_diamond_shape](https://github.com/AG-444/Beginners-Python-Projects_AP/blob/main/diamond_symbol.py) - [Aditya Garg](https://github.com/AG-444)
3333
16. [email response sender](https://github.com/arnavvgupta/email-response-sender) - [Arnav Gupta](https://github.com/arnavvgupta)
3434
17. [Quick Sort](https://github.com/varshaah2407/Beginners-Python-Projects/blob/main/quick_sort.py) - [Varshaah Shashidhar](https://github.com/varshaah2407)
35-
35+
18. [aritmetic median, biggest number and lowest number](https://github.com/arnavvgupta/functionMaxMinMedian.py)
3636

functionMaxMinMedian.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
def bth(a, b, c, d, e):
2+
return max(a, b, c, d, e)
3+
4+
def sml(a, b, c, d, e):
5+
return min(a, b, c, d, e)
6+
7+
def aritmetic_median(a, b, c, d, e):
8+
return (a+b+c+d+e)/5
9+
10+
def main():
11+
n1 = int(input(" "))
12+
n2 = int(input(" "))
13+
n3 = int(input(" "))
14+
n4 = int(input(" "))
15+
n5 = int(input(" "))
16+
17+
mx = bth(n1, n2, n3, n4, n5)
18+
mnr = sml(n1, n2, n3, n4, n5)
19+
median = aritmetic_median(n1, n2, n3, n4, n5)
20+
21+
print(f'biggest number {mx}, smallest number {mnr}, aritimetic median: {median}.')
22+
23+
if __name__== '__main__':
24+
main()

0 commit comments

Comments
 (0)