You are here: Practice · Guess

A different day

The phone picks a number. You guess.

It says too high or too low. That is the whole game. You need a secret number, a guess, a comparison, and a way to try again. This page will not write the file for you.

Goal

A script that chooses a number, asks you to guess, and tells you whether to go higher or lower until you hit it.

Ideas you need first

input to ask. A variable to hold the secret and another to hold the guess. if / else for too high and too low. A loop if you want more than one try. Week 2 words. If those still feel new, write a one-guess version first.

A starter shape, not the whole file

Pick a secret, even a fixed number like 7. Ask for a guess. Print one sentence. Make that work. Only then make the secret random and the guesses repeat.

If it breaks

input gives you text. Comparing text to a number confuses Python. Ask Grok: “I am on Termux. input gave me a string. I need a number. Explain like I have never coded.”

Do not

Do not paste “write a complete number guessing game” and submit the result as yours. Hints. Then type.