Files
coding-mentor-agent/kb/python-course-kb-practical-python/wiki/exercises/1-15-membership-testing-substring-testing.md
T

38 lines
854 B
Markdown

---
id: practical-python-1.15
source_exercise_id: "1.15"
title: "Membership testing (substring testing)"
section: "1.4 Strings"
source_path: "01_Introduction/04_Strings.md"
source_repo: "https://github.com/dabeaz-course/practical-python"
source_commit: "93dca856b41c61a0a0f85ae334116e4c125629ea"
student_visible_solution: false
has_private_solution: false
skip: false
---
# Exercise 1.15: Membership testing (substring testing)
> Source: Practical Python Programming, `01_Introduction/04_Strings.md`.
### Exercise 1.15: Membership testing (substring testing)
Experiment with the `in` operator to check for substrings. At the
interactive prompt, try these operations:
```python
>>> 'IBM' in symbols
?
>>> 'AA' in symbols
True
>>> 'CAT' in symbols
?
>>>
```
*Why did the check for `'AA'` return `True`?*
## 关联来源
- [[summaries/04_Strings]]