returning “None” type : ( [duplicate]

I wrote these codes but it returns ‘None’!\

def compare(string1, string2):
   if string1 == string2 == '':
       return "Both strings are empty!"
   elif string1 == '':
       return string2
   elif string2 == '':
       return string1
   else:
       string1 = list(string1)
       string2 = list(string2)
       if string1[0] > string2[0]:
           del string2[0]
       elif string1[0] < string2[0]:
           del string1[0]
       else:
           del string2[0]
           del string1[0]
       if string1 != [] and string2 != []:
           string1.reverse()
           string2.reverse()
       string1 = ''.join(string1)
       string2 = ''.join(string2)
       compare(string1, string2)`

I want that it return ‘str’ type

Leave a Reply

Your email address will not be published.