相关文章推荐
小眼睛的热带鱼  ·  Python equivalent of ...·  3 周前    · 
俊逸的火锅  ·  Python 控制台 — Blender ...·  3 周前    · 
健身的抽屉  ·  在 Google Cloud 上使用 ...·  3 周前    · 
直爽的黑框眼镜  ·  Difference between ...·  3 周前    · 
踏实的蟠桃  ·  python - How to run ...·  3 年前    · 
会搭讪的花卷  ·  飞猪 - 开放平台·  3 年前    · 
性感的小虾米  ·  kafka | How to use ...·  3 年前    · 
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.