mercredi 16 juin 2021

How to get the code to make the user pick between different ranges of random numbers in python? [closed]

I want to make a code that generates random numbers from 3 different choices that the user can pick from but the code just doesn't recognize the variable I put to represent those choices. Here is what I've got so far:

import random

choose = int(input("1, 2 or 3? "))

if choose == 1:
  num == random.randint(1, 10)
elif choose == 2: 
  num == random.randint(10, 50)
elif choose == 3: 
  num == random.randint(1, 100)
else:
  print("Invalid input")


print(num)

Can someone help?




Aucun commentaire:

Enregistrer un commentaire