IT104 LabTask LB9.0
IT104 LabTask LB9.0
LB9 1
The Pseudocode 1. Module main () 2. Declare Int Count 3. Declare Int total 4. Declare Int studentCount 5. Declare Int score 6. Declare Int total 7. Declare Int average
LB9 2 Week Nine Lab Exercise 8. //While statement will begin 9. WHILE True 10. //Will have the user input how many took the test. 11. Display How many students took the test: 12. Input studentCount 13. count = 0 14. total = 0 //Will set up the needed times for the user to input the scores 15. WHILE count < studentCount: 16. //Has the users input the scores & displays the average test scores 17. Display Enter their score: 18. Input score 19. total = total + score 20. count=count+1 21. average = averageScore 22. Display The average test score is,average 23. Display Do you want to end the program? (Enter no to process new set of scores) 24. //Will calculate the average of the scores to return to the main module. 25. Def averageScore (scoreTotal, count): 26. Average = scoreTotal / count 27. Return average 28. 29. Main()
LB9 3
The Flowchart
LB9 4 Week Nine Lab Exercise The Python Code #James Espinoza #February 14 #Lab 9 #This program will use the while function. def main(): #ask the user how many students took the test. while True: studentCount= int(raw_input("How many students took the test:")) count= 0 total= 0 #Will set up the required times it is needed for the user to input scores & display the average of scores. while count < studentCount: score = int(input("Enter their score: ")) total = total + score count=count+1 average = averageScore(total,studentCount) print "The average test score is",average endProgram = raw_input("Do you want to end the program? (Enter no to process a new set of scores):") if endProgram=='yes': break #Will calculate the average of the student scores and return it to the main def averageScore(scoreTotal,count): average = scoreTotal/count return average main()
LB9 5
1. Ensure you have completed all of the tasks required for this lab. 2. Save your lab worksheet and your Raptor and Python files to your instructors network share. There
should be a total of three files saved.
3. Here is what you need to be able to save your work on your instructors network share:
\\10.46.108.76 Username: student Password: P@ssw0rd Users Public IT104 <your_name> WeekNine