I am new to Python and trying to generate 5 numbers with 2 conditions:
- There must be 3 even and 2 odd numbers
- From those 5 numbers 3 must be low (1,51) and 2 high (51,100). Which number will be low or high is not of interest.
I have managed to solve the first part:
import random
rand_even = random.sample(range(0, 100, 2), 3)
rand_odd = random.sample(range(1, 100, 2), 2)
rand_total = rand_even,rand_odd
print(rand_total)
Obviously this is not getting me anywhere For the second part i thought i could use something like:
rand_low = random.sample(range(0, 51), 3)
rand_high = random.sample(range(51,100), 2)
But obviously this is not the way as i am getting more than 5 numbers.
Any help would be appriciated. Thank you