-1

When I run the following code the output is "None"? I'm trying to write a function that would print a random number between two values depending whether parameters are present or not.

import random
def randInt(min="", max=70):
  if min and max == False:
    return random.random() * 80
  elif min == False:
    return random.random() * max
  elif max == False:
    return random.random() * min + 100
print(randInt())
martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

0

You need to spell out the first test.

if min == False and max == False:

Or shorten it like:

if min == max == False:
John Kugelman
  • 349,597
  • 67
  • 533
  • 578