Python Forum
I am stuck on functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am stuck on functions
#1
Hi all, I am working on a lab assignment and I am stuck...probably because it's friday and my brain stopped at 5pm. At any rate, here's the actual problem:
Create a Python program that does the following:

Each gymnast in a competition receives scores from 5 judges.
• Create a loop that loops 5 times
• Inside the loop, prompt the user to enter a score (from 0 to 10), and store it in a list
• After the loop, call a function called scoreCalculator, and pass the list to it
• The scoreCalculator function should calculate the average of the 5 scores, and return that average
• Display the average that you get back from the function like so

The average score is 8.637


My code is crap, but this is what I'm doing right now. I am beyond confused...any help would be greatly appreciated. I basically can't get the function to call the list and then return it as a print statement.

=====================================
def scoreCalculator(scores):
        total = scoreCalculator
        for score in scores:
            total = sum(scores)
    return score / 5


    scores = [0]
    count = 0

    while count < 5:
        number = input("Enter a score (0 - 10) -> ")
        scores.append(number)
        count += 1
Reply


Messages In This Thread
I am stuck on functions - by Hebruiser - Nov-11-2017, 02:07 AM
RE: I am stuck on functions - by Larz60+ - Nov-11-2017, 02:20 AM
RE: I am stuck on functions - by wavic - Nov-11-2017, 02:24 AM
RE: I am stuck on functions - by wavic - Nov-11-2017, 11:15 AM
RE: I am stuck on functions - by Larz60+ - Nov-11-2017, 11:56 AM
RE: I am stuck on functions - by Hebruiser - Nov-11-2017, 02:48 PM
RE: I am stuck on functions - by Mekire - Nov-11-2017, 03:00 PM
RE: I am stuck on functions - by Hebruiser - Nov-11-2017, 03:30 PM
RE: I am stuck on functions - by Mekire - Nov-11-2017, 04:06 PM
RE: I am stuck on functions - by Hebruiser - Nov-11-2017, 06:42 PM
RE: I am stuck on functions - by wavic - Nov-11-2017, 08:32 PM
RE: I am stuck on functions - by Hebruiser - Nov-11-2017, 08:46 PM

Forum Jump:

User Panel Messages

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