Finding larget and smallest number in a list in Python
One straight forward method is to iteratively check each element of the list and compare it with the previous one. Keep the desired and discarding the another one. Or we can simply use the inbuilt min and max functions.
Python: 3.0    Anurag Rana    19 Jul 2021   0
Login to upvote
1
2
3
4
current_list = [1, 2, 3, 4, 5]

print(min(current_list))  # 1
print(max(current_list))  # 5
Copy | Download as: .py file   PNG
Share on: FB   Twitter   LinkedIn   WA
©2021 - code108labs   Contributors   Hosted on DigitalOcean   Partner website: pythoncircle.com