Python Typing/Vocabulary Game
Today, I'm giving you the code. But before we begin playing, let's understand how the code executes the game. There are only a couple of new concepts introduced in this game, but everything else should be very familiar to you.
Follow these steps below:
- Log into your Google account
- Log into jdoodle.com using your Google account (don't make a new account)
- Copy and paste the code below to your JDOODLE account.
- Play the game
import random
import time
import os
# Vocabulary lists by grade
six_words = ["adapt", "benevolent", "contrast", "deduce", "evidence", "formulate", "hypothesis", "influence", "justify", "relevant"]
seven_words = ["advocate", "coherent", "derive", "emerge", "fluctuate", "imply", "mediate", "profound", "resilient", "substantiate"]
eight_words = ["abate", "assimilate", "concede", "dissipate", "erratic", "flourish", "impulsive", "longevity", "malleable", "obstruct", "render", "rueful", "subordinate", "tarry", "transgression"]
def clear_screen():
os.system("cls" if os.name == "nt" else "clear")
print("Welcome to the Vocabulary Typing Game!")
print("Choose your grade level:")
print("6 - Sixth Grade")
print("7 - Seventh Grade")
print("8 - Eighth Grade")
grade = input("\nEnter your grade (6, 7, or 8): ").strip()
# Select the appropriate word list
if grade == "6":
words = six_words
elif grade == "7":
words = seven_words
elif grade == "8":
words = eight_words
else:
print("Invalid grade. Defaulting to 8th grade list.")
words = eight_words
# Show vocabulary preview
print("\nHere are your vocabulary words:\n")
print(", ".join(words))
start = ""
while start != "y":
start = input("\nType 'y' when you're ready to start: ").strip().lower()
if start == "y":
clear_screen()
print("Great! Let's begin.\n")
random.shuffle(words)
score = 0
start_time = time.time()
for word in words:
print(f"Your word is :{word}")
typed = input("Type the word:").strip()
if typed == word:
print("✅ Correct!\n")
score += 1
else:
print(f"❌ Oops! The correct word was '{word}'.\n")
end_time = time.time()
elapsed = round(end_time - start_time, 2)
print(f"Game Over! You scored {score} out of {len(words)}.")
print(f"Time taken: {elapsed} seconds.")
else:
print("Okay! Come back when you're ready.")

