# Python Forum

You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

i have input variable x and generated random variable a

i want to x*a < 250 with the highest x*a value

I am stuck with the highest x*a value

Can you help me about that ?
I don't understand "highest" in your description. If you only have one x and one a, then x*a is fixed.

You can solve directly for the maximum a that would allow the expression to be true:
x * a < 250
a < (250 / x)

So 250 / x is the maximum value a could be and the expression is still true.
```while  k != True:
a = random.randint(1,int(250/x))
b = random.randint(1,int(250/y))

if a*b in denominator(z) and 75<x*a<250 and 75<y*b<250:

print(a,b)
print("X = ",(x*a),"Y =",(y*b))
print(a*b)
print("Panel sayisi:", z/(a*b))
k = True```
By the help of you i updated randint max integer but i still get some values which is below my desire because random variables are between 1 and int(250/x).I think i have to make some changes on if line to get max(x*a)<250.I cant change randint min value which is 1 because a*b must be in the list which is i generated as a denominator. Do you have any idea ?

Problem Solved. Ty for help