CodeAgeBy Sitezack
Python for Builders — Level 4Functions and lists0 XP
Chapter progress0/6

Lesson 6 of 7

A word is a list of letters

A text behaves like a list: secret[0] gives the first letter, and you can walk through it with for.

The in keyword tests whether a letter is inside: "y" in "python" is True.

word = "code"
print(word[0])      # c
print("o" in word)  # True

🎯 Your mission

With secret = "python": store the first letter in first, test whether the letter "y" is in the word with has_y, then print first.

PRO lesson

This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.

Discover PRO