Lesson 22 of 30

Lesson 22 ? Word game

Title: Play with letters and words

Description: Build tiny word games with strings, loops, and lists.

Why it matters for kids: Word games are fun and help you practice string skills.


1. Count letters

pythonpython
word = "banana"

print(len(word))

len() tells you how many characters are inside.


2. Print letters one by one

pythonpython
word = "robot"

for letter in word:
    print(letter)

3. Make a shout

pythonpython
message = "coding is fun"

print(message.upper())

4. Simple secret word check

pythonpython
secret_word = "python"
guess = input("Guess the word: ")

if guess.lower() == secret_word:
    print("Correct!")
else:
    print("Try again.")

5. Easy examples

pythonpython
name = "Mia"

print(name[0])
print(name[-1])
pythonpython
word = "pop"

if word == word[::-1]:
    print("Same forward and backward!")
pythonpython
sentence = "I like Python"
words = sentence.split()

print(words)

6. Mini challenge

Click each example to open it.

Example 1

Print the length of cat.

Example 2

Print each letter in robot.

Example 3

Make one word uppercase.

Example 4

Make one word lowercase.

Example 5

Print the first letter of your name.

Example 6

Print the last letter of a word.

Example 7

Split a short sentence into words.

Example 8

Check a secret word.

Example 9

Check if pop is a palindrome.

Example 10

Print each letter with a star.