Python Forum
I am stuck on functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am stuck on functions
#11
Well, first you have to create a variable which will hold the incrementing sum as you loop over the list. So:

sum = 0
For each number in the list:
    add the number to the sum
Then return the average 
This is a pretty basic usage of a loop so I doubt that you will face some obstacles. 
Another thing. You are calling the scorecalculator() function inside the while loop. Also, you have to assign the returned result to a variable because the function just returns something but this object is never used.

var = func()
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#12
i think i need to go back and spend the rest of the day doing the practice exercises in the book. I am just not getting it. I may not be cut out for this. I'm learning bash scripting right now, too...with Perl, so everything is running together!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020