Write a function to calculate the frequency of a number in a list


Topic: Write a function to calculate the frequency of a number in a list

Solution

def frequency(list, num):
    count = 0
    for item in list:
        if item == num:
            count = count + 1
    return count



List all Python Programs