Is there a simple if statement to battle this problem? The first block is my code so far, the second block is the boolean output I wish would be printed.
if string.startswith("*") and string.endswith("*"):
return True
else:
return False
print(string_startend_function('*JohnDoe*')) # True (This answer my code can achieve)
print(string_startend_function('*')) # False (This answer my code can't achieve)
I need my code to display False if the startswith * and endswith * are the same singular *, is there anyway to achieve this, with adding a elif statement after the if statement?