id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String Operationsends_with

prev  |  next  |  chance

endswith() returns True if a string ends with a specified substring.

def ends_with(s1, s2):
    result = s2.endswith(s1)
    return result
Function Call  Return Value
ends_with('o', 'Hello')
ends_with('ll', 'Hello')
ends_with('llo', 'Hello')
ends_with('5', '525')
ends_with('52', '525')
ends_with('25', '525')
ends_with('g', 'Egg')
ends_with('', 'World')
ends_with(' ', 'Hello World ')
ends_with(' ', 'HelloWorld')

Experiment with this code on Gitpod.io

⬅ Back