Ask coding questions

← Back to all posts
I need help here
ChromaQ (0)

I am writing a bot for my server on discord and thus i need a code that can give me this 'pick random (digit) to (digit)'

Yes i am new with python.

Thank you. ChromaQ

Comments
hotnewtop
MuffinsTheCat (18)
import random as ran
digit = idgaf what it is
digit = i also dgaf what it is
print(ran.randint(digit, digit))

note that the first number should always be lower than the second

ChromaQ (0)

@MuffinsTheCat So does i just replace the 'digit' with whatever i need to my bot to choose randomly from?

MuffinsTheCat (18)

@ChromaQ Yes. here, let me explain it more for random functions

import random
function1():
  #dog go fishing

function2():
  #dog go bark
n = random.randint(1,2)
if n == 1:
  del n
  function1()
elif n == 2:
  function2()