This program demonstrates how to find the maximum and minimum elements of a set in Python. The code first declares a set a containing integers. The set is then printed to show its original values. Next, the max() function is used to find the maximum element of the set a. Similarly, the min() function is used to find the minimum element of the set a. In this example, the max() function returns the value 56, which is the maximum element in the set a. The min() function returns the value 8, which is the minimum element in the set a.
a = {23,45,17,8,56,10} print("Set A :",a) print("\nMaximum of A :",max(a)) print("Minimum of A :",min(a))
Set A : {17, 56, 23, 8, 10, 45} Maximum of A : 56 Minimum of A : 8
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions