Task is to : Write a function to check if one string is a substring of another, ignoring capitalisation.
I have this code so far but getting an error, any help would be great :
def is_substring(word, subword):
if subword.lower() in word.lower():
return True
else:
return False
c = is_substring('function', 'fun')
print (c)
This was my error :
Testing the first example in the question. Your submission did not produce the correct output. Your program output:
True
True
when it was meant to output:
True
Could anyone guide me to what is wrong with my code? Thanks.
if __name__ == '__main__':block so it isn't executed by other programs thatimportyour script.