String Contains in Python

Level 122 keystrokes

This checks if 'lo' exists in 'Hello'. The 'in' operator returns True if a substring is found.

Python code

# in checks whether the left string appears inside the right one
# "Hello" ends with "lo", so the result is True
1print("lo" in "Hello")

Output

True
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • "× 4
  • (× 1
  • )× 1

More Python examples at level 1

← Python typing practice