if value >= star3value:
got 3
elif value >= star2value:
got 2
elif value >= star1value:
got 1
else:
probably lost...
Basically just that, then you need to define what is 1, 2 and 3, if that is set/register for each level or global and other details, design stuff.