Editor settings

General settings

Save settings

Learn to program with Python

String starts with #

Write a function that checks whether a given string starts 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 starts with the specified substring.

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

Tests #

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