Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def scores(students):
- sum = 0
- mean = 0
- lowest = students[0]
- highest = students[len(students)-1]
- for i in range(len(students)):
- sum += students[i]
- if lowest > students[i]:
- lowest = students[i]
- if highest < students[i]:
- highest = students[i]
- if highest < lowest:
- highest, lowest = lowest, highest
- mean = sum /len(students)
- return lowest, highest, sum , mean
- lowest = 0
- highest = 0
- sum = 0
- mean = 0
- students = [10, 3, 6 , 7, 9, 5, 4]
- lowest, highest, sum, mean = scores(students)
- print("The scores list is: ", students)
- print(f"lowest: {lowest}, highest: {highest}, sum: {sum}, mean: {mean}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement