How do i make a module that'll get me an average?! thx - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How do i make a module that'll get me an average?! thx (/thread-15967.html) |
How do i make a module that'll get me an average?! thx - dokser239 - Feb-08-2019 #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() Get average module - dokser239 - Feb-08-2019 Hello everyone! I basically need to make a module to get , return and print an average. I'm stuck because i don't know how pull off that string! it's a basic programming exercise i'm practicing. can anyone send me an example? thx and sorry for, one of many noob questions RE: How do i make a module that'll get me an average?! thx - micseydel - Feb-18-2019 What do you mean you "don't know how to pull off that string"? We'd love to help, but in this thread it seems like you've posted your homework without actually asking a question. |