Computer Science, asked by lakshyaanant70, 2 months ago

WAP to display square of an element if it is an integer and change the case if element is a string. List is received as argument which contains both numbers and strings

Answers

Answered by nandanramesh123
4

Here is your Program !

def func ( input_list ) :

   for i in input_list :

       if type ( i ) == 'int' :

           print ( i**2 )

       elif type ( i ) == 'string' :

           if i.isupper ( ):

               print ( i.lower ( ) )

           else :

               print ( i.upper ( ) )

       else :

           print ( i )

input_list = input ( )

func ( input_list )

       

input_list = [  ]

Similar questions