Python Forum
How do i make a module that'll get me an average?! thx
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do i make a module that'll get me an average?! thx
#1
#This is the code i am trying to write
#its you're beginner "average test score" programming exercise
#how do i make a module that'll get the average , return the average and print the average?
#please help, thx
def main():

    endProgram, totalScores, counter, scores, averageScore, number = declaredVariables()

    while endProgram == "no":
        endProgram, totalScores, counter, scores, averageScore, number = declaredVariables()

        number = getNumber()
        totalScores = getScores(counter, scores, number, totalScores)


def declaredVariables():
    endProgram = "no"
    totalScores = 0.0
    counter = 0
    scores = 0.0
    averageScores = 0.0
    number = 0
    return endProgram, totalScores, counter, scores, averageScores, number

def getNumber():
    number = input("How many students took the test: ")
    return number

def getScores(counter, scores, number, toalScores):   
    for counter in range(0, 100):
        Scores = input("Enter score for the students: ")
        totalScores = totalScores + scores 

    return totalScores
        
main()
Reply


Messages In This Thread
How do i make a module that'll get me an average?! thx - by dokser239 - Feb-08-2019, 03:38 AM
Get average module - by dokser239 - Feb-08-2019, 09:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot make 'pandas' module to work... ellie145 2 4,228 Jan-05-2021, 09:38 PM
Last Post: ellie145

Forum Jump:

User Panel Messages

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