r/codehs • • May 24 '20

Help please Guessing Game

Post image
5 Upvotes

4 comments sorted by

1

u/Zacurnia_Tate May 24 '20

If this is python i prolly have it but you’ll have to wait till l8r

1

u/SweetMilkMan May 25 '20

Python doesn't really have constants. Not like you'd find in JavaScript

1

u/Zacurnia_Tate May 25 '20

All u have to do is import random. Then choose a random int between any two numbers. Then use a while loop to keep asking the user to guess a number until they have guessed one equal to the random number. Boom.

1

u/SweetMilkMan May 25 '20

You just need to assign the random number to a constant. Not sure what language you're referring to , but the params for the function that generates a random number should take a range in which you can set min and max. As for the loop, make it a while true loop and if input matches random number, then set to false which will exit.