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

1 Answer

0 votes
s = "python java c c++ php python"
        
if (s.startswith('python') and s.endswith('python')) :
    print("yes")
else:
    print("no")
 
 
  
  
'''
run:
  
yes
  
'''

 



answered Nov 16, 2019 by avibootz

Related questions

...