def first_and_last(message):
if (message[0] == message[3]):
return True
elif (message[0] != message[3]):
return False
print(first_and_last("else"))
print(first_and_last("tree"))
print(first_and_last(""))
I want to return True if string is empty, True if 1st and last letter of string match and False otherwise.
How can I get a True result for an empty string?
if (message == ''): return Trueis an option. What do you think?[-1]instead of[3]. If you use[3]thenfirst_and_last("abcad")will returnTrue