lundi 16 novembre 2020

Generating random number in within an inputted range

I am trying to write a piece of code that prompts the user to input a number, and the loop will only stop if the input number matches the random generated number. The random number should be in within the range the user input.

import random
randNumber = random.randint(min, max)

min = int(input("Choose a minimum number range: "))
max = int(input("Choose a maximum number range: "))

while True:

  if guess > randNumber:
    print("Too big, try again")

  if guess < randNumber:
    print("Too small, try again")

  if guess == randNumber:
    print("BINGO!")
    break

The system keeps telling me "tuple object not callable" for my 2nd line.




Aucun commentaire:

Enregistrer un commentaire