๐Ÿค– AI Project: “Mind Reader Number Guessing AI”

 

๐Ÿค– AI Project: “Mind Reader Number Guessing AI”

๐ŸŽฏ Instructions for Students

1.      Think of a number between 1 and 20.

2.      Do not tell the computer your number.

3.      Answer the computer’s questions with:

o    yes

o    higher

o    lower

The AI will try to guess your number. ๐Ÿง 


๐Ÿ’ป Python Code (Small Range Version)

print("๐Ÿค– Welcome to Mind Reader AI!")
print("Think of a number between 1 and 20.")
input("Press Enter when you are ready...")

low = 1
high = 20

while low <= high:
    guess = (low + high) // 2
    print("\nIs your number:", guess)
   
    answer = input("Type 'yes', 'higher', or 'lower': ")
   
    if answer == "yes":
        print("๐ŸŽ‰ I guessed your number!")
        break
    elif answer == "higher":
        low = guess + 1
    elif answer == "lower":
        high = guess - 1
    else:
        print("Please type yes, higher, or lower.")

๐Ÿงช Example

Student thinks of 14

AI: Is your number 10? → higher
AI: Is your number 15? → lower
AI: Is your number 12? → higher
AI: Is your number 13? → higher
AI: Is your number 14? → yes

๐ŸŽ‰ AI guessed correctly!

Comments

Popular posts from this blog

Funny AI Project

Home Work on 14-03-2026