ladarks7 ladarks7
  • 26-09-2021
  • Computers and Technology
contestada

How to limit the number of guesses in python

Respuesta :

Heather
Heather Heather
  • 26-09-2021

I thinkkkkk this is kind of what you are looking for?

while user != the_number:

   ...

   if count == 5:

       print("etc etc")

       break

else:

   print("You guessed it!!, the number is", the_number, "and it only"\

         " took you", count , "tries")

Basically if you have 5 guesses it'll break it and stop the guesses

Answer Link

Otras preguntas

Explain what would happen if an electron and a proton were brought near each other and then released. why would this happen?
An expression whose definition is not usually predictable from the typical word meanings? A. Malapropism B. Idioms C. Cliché D. Puns
if an interest inventory reveals that you are highly interested in solitary, introverted work, what might be the best type of career for you?
Round to the nearest ten thousand 141,173
what is negative seven tenths
-77.35 in a fraction
How do you find prime factorization?
Show an equation using halving and doubling
Natural born citizen
Which phrase correctly completes this sentence? ____________ es boliviano. La maestra Los maestros El maestro Las maestras