I'm learning python on singpath. And I trying to difficulty hard.
Anyways, I have to return values str,float,int.
I succeed almost question but I can't solve only 2 questions.
these:
>>>str_int('hi',2)
hihi
>>>str_int(3,'bye')
byebyebye
but in my case:
>>>str_int('hi',2)
hi2
>>>str_int(3,'bye')
3bye
I can't understand why my code return that values without error.
this is my code:
def str_int(a,b):
if type(a) == type(b):
return a+b
elif type(a) or type(b) == str:
if type(a) and type(b) == float:
return a+b
elif type(a) or type(b) == float:
return str(a)+str(b)
return a*b