Skip to main content

Posts

Showing posts with the label while loop

To find a maximum number from a list, then finding the length of that maximum number and the total number of elements in the list using python.

Now this is how we can find the maximum number from the list. Length of the maximum number from the list. The total number of elements from the list. a = [ 54654 , 854 , 21 , 715732143241974 , 871 , 6354 , 9753 , 21 ] print ( 'the maximum number from the list is:' , max (a)) def digits (a): count = 0 while a != 0 : count+= 1 a=a// 10 return count print ( 'length of the maximum number from the list is:' , digits( max (a))) print ( 'the total number of elements in the list are:' , len (a))