w3resource logo


Python Exercises

Python Exercise: Find maximum and the minimum value in a set

Python sets: Exercise-14 with Solution

Write a Python program to find maximum and the minimum value in a set.

Sample Solution :-

Python Code :

#Create a set
seta = set([5, 10, 3, 15, 2, 20])
#Find maximum value
print(max(seta))
#Find minimum value
print(min(seta))

Output :

20
2

Python Code Editor:

#Create a set
seta = set([5, 10, 3, 15, 2, 20])
#Find maximum value
print(max(seta))
#Find minimum value
print(min(seta))

Improve this sample solution and post your code through Disqus.



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program