I am new to python, can someone please explain to me why below code will loop for 5 rounds?I roughly guess it is because of this [i>=4 for i in ratings], but I still don't get it.
Code
def percentage_liked(ratings): list_liked = [i>=4 for i in ratings] print("-----") percentage_liked = sum(list_liked)/len(list_liked) return percentage_likedprint("******")print(percentage_liked([1, 2, 3, 4, 5, 4, 5, 1]))
Result
******-----0.5--------------------
Explanation on why it loop for 5 times