repeat function if something is not equal?

OK, this is prolly simple ,but don’t know how to do it. I found this bit of code that you can tell it how many times to do whatever.

Prints hey 3 times.

for _ in range(3):

What I’m trying to do is repeat a function if something isn’t equal. How do I do that?

Example would be, if something is = 1 and needs to be = 3 it repeats function until it’s equal to 3 (twice). Don’t know if that makes any sense.

something = 1
needs_to_be = 3

for i in range(something, needs_to_be):