0

Hey so Im a beginner, and I need some help.

My professor gave us this code:

def average(list):
     total = 0.0
     for number in list:
          total += number
     return total / len(list)

Then, he asked us to rewrite that program so that it uses a while loop instead.

I have no idea :/ Everything I've tried so far doesn't give me the right answer.

If you could please help me, I'd be forever grateful

Edited by mkbear: n/a

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by askandstudy
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.