import random
nums = [x for x in range(50,100) if x%2!=0]
print(random.choice(nums))
We use a list comprehension to create a list of the odd numbers between 50 and 99. Then we randomly choose one of those numbers using the random module.
4.5m questions
5.7m answers