Untitled
unknown
python
3 years ago
360 B
10
Indexable
def StarRating(strParam):
rating = []
left = int(strParam[:1])
right = float(strParam[1:])
rating = ['full'] * left
if right < 0.25:
rating.append('empty')
elif right < 0.75:
rating.append('half')
else:
rating.append('full')
rating += ['empty'] * (5 - len(rating))
return ' '.join(rating)Editor is loading...