mercredi 4 janvier 2023

How can I compare two randomly generated numbers within two functions with each other?

I'm trying to compare two random numbers (each returned by a function) because I need to select a random element from a list and then turn the second number into the same +1 if they are equal.

Here's my code:

def random_1():
  first_random_num = randint(1, 50)
  return first_random_num

def random_2():
  second_random_num = randint(1, 50)
  return second_random_num
  
  if random_1() == random_2():
    print("hello")
  else:
    print("World")

OUTPUT:

 ...



Aucun commentaire:

Enregistrer un commentaire