How to Check if a Python String Contains a Substring Quiz

Interactive Quiz ⋅ 16 Questions
By Martin Breuss

Now that you’ve learned how to check if a string contains a substring, it’s time to test your knowledge with this quiz!

Python
>>> "knowledge" in "brain"
False

Don’t worry, you’ll do better than that! Prove that pesky code block wrong and dive into answering the following quiz questions.

If you get a question wrong, then go back into the associated part of the tutorial and refresh your memory. Making mistakes is a great way to learn!

The quiz contains 16 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!

Related Resources

Course

Check if a Python String Contains a Substring

In this video course, you'll learn the best way to check whether a Python string contains a substring. You'll also learn about idiomatic ways to inspect the substring further, match substrings with conditions using regular expressions, and search for substrings in pandas.

basics best-practices

Tutorial

How to Check if a Python String Contains a Substring

In this tutorial, you'll learn the best way to check whether a Python string contains a substring. You'll also learn about idiomatic ways to inspect the substring further, match substrings with conditions using regular expressions, and search for substrings in pandas.

basics best-practices python