Editor settings

General settings

Save settings

Learn to program with Python

String Ends With #

Write a function that checks whether a given string ends with another specified string. The function takes two arguments, the main string and the substring to check. The function should return a boolean value indicating whether the string ends with the specified substring.

We suggest that you avoid using the endswith() method to solve this challenge and try to solve it on your own.

Tests #

  • endswith("PythonExpert is amazing!", "amazing!") should return True
  • endswith("The quick brown fox jumps over the lazy dog.", "lazy dog.") should return True
  • endswith("Hello, World!", "world!") should return False
  • endswith("Python programming is awesome!", "awesome") should return False
  • endswith("I love coding!", "coding!") should return True
Output will be displayed here