Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am making a little text based game where you have to guess the number that is between certain criteria which can either be preset by the user or by a random number generator but the problem is when I try to randomly generate the two parameters for the game I get an error 'ValueError: int() base must be >= 2 and <= 36, or 0'

I dont actually know what I should try as I have never encountered this problem before.

import random
Guess = 0
Run = ("Yes")
while Run == ("Yes"):
    Number_1 = random.randint(1, 30)
    Number_2 = random.randint(int(Number_1, 999999999999))
    Answer = random.randint(int(Number_1), int(Number_2))
    while int(Guess) != int(Answer):
        Guess = (input("\nWhat is your guess? > "))
        if int(Guess) < int(Answer):
            print("The answer is Greater then that.")
        if int(Guess) > int(Answer):
            print("The answer is less then that.")
        print("Congrates on guessing correctly!!")
        Again = (input("\nDo you want to play again? ('y' or 'n') > "))
        if Again == ("y"):
            Run = ("Yes")
        if Again == ("n"):
            Run = ("No")

I expect it to generate 2 numbers a lowest possible number and a highest possible and then have the user try to guess that number but it cant seem to properly generate the number.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.