Max and Min , Conversion of Tuple into list,string or list into tuple and it type , in Python


Tuple into list,string or list into tuple and it type , in Python

Max and Min in Python

 This article is very interesting and
Lesser known functions of Python, i.e max ()
And min (). Now when they are compared to C ++
The opposition, which makes only two arguments,
That too strictly float, int or char, these
Functions are not only limited to 2 elements, but can hold many elements as arguments and can also support strings in their arguments, therefore lexicographically allowing even the smallest or largest string to be displayed .


number = (12,5,15,5)

print(max(number))                     # max 15

print(min(number))                     # min 5

print(sum(number))                     # sum 37
 

# Conversion of Tuple into list,string or list
into tuple and it type


nums=(1,2,3,4,5,6,7,8,9)

print(type(nums))              # <class,'tuple'

nums1=list(nums)

print(nums1)       # OutPut = [1,2,3,4,5,6,7,8,9]

print(type(nums1))   # OutPut = <class,'list>

nums2=str(nums)

print(type(nums2))     # OutPut = <class,'str'>

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

You have successfully subscribed to myprogrammingschool

There was an error while trying to send your request. Please try again.

My Programming School will use the information you provide on this form to be in touch with you and to provide updates and marketing.