Daily Python Projects
Python Code Dictations
Number Guessing Game - Python Code Dictation
0:00
-2:17

Number Guessing Game - Python Code Dictation

Level: Easy 🟡

What is this post about?

This is an audio code dictation to help learners memorize Python syntax. Follow these steps to complete a dictation:

  1. Open a code editor on your computer.

  2. Play the audio and type the narrated code while listening.

  3. Compare your code with the correct code below.

Correct Code

import random

target_number = random.randint(1, 10)

guess = int(input("Guess the number (between 1 and 10): "))

 if guess == target_number:
    print("Congratulations! You guessed the right number.")
else:
    print(f"Sorry, the correct number was {target_number}.")

Discussion about this episode