'calculating list average with while loop (python)

I'm a beginner learning python, trying to Modify this function so it uses while loops:

def avg(L):
    s = 0
    for num in L:
         s = s + num
    return s/len(L)

I know I need to iterate over the list index, but I can't seem to find the right way. I'll appreciate any leads, thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source