How to check if a string starts and ends with specific character in Python

1 Answer

0 votes
str = "#python#"

if (str[0] == '#' and str[len(str) - 1] == '#'):
    print("yes")
else:
    print("no")
    


'''
run:

yes

'''

 



answered Apr 18, 2019 by avibootz

Related questions

...