(4/10)

Magic Word Game — Python typing lesson

Build an interactive game combining loops and conditions.

What you'll practice

Let's play a game and learn about string methods! These are special powers for working with text.

  • `.upper()` changes a string to all uppercase letters.
  • `len()` tells you the length (number of characters) of a string.

Pro Access Required

This is a premium lesson. Upgrade to Pro to unlock this interactive exercise and continue your learning journey.

🐍Python

Magic Word Game

0 WPM
0% Accuracy
0:00 Time elapsed
1
2
3
4
5
6
7
8
9
secret_word = 'PYTHON'↵
guess = input('Guess the word: ')↵
↵
if guess.upper() == secret_word:↵
print('You got it!')↵
else:↵
print('Nope, not the word!')↵
↵
print('Your guess had ' + str(len(guess)) + ' letters.')
0 / 212
Press This!
👇
`~
1!
2@
3#
4$
5%
6^
7&
8*
9(
0)
-_
=+
⌫
⇥
Q
W
E
R
T
Y
U
I
O
P
[{
]}
\|
⇪
A
S
D
F
G
H
J
K
L
;:
'"
↵
⇧
Z
X
C
V
B
N
M
,<
.>
/?
⇧
Thumb
Index
Middle
Ring
Pinky