forked from psounis/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexercise05.py
More file actions
40 lines (28 loc) · 733 Bytes
/
exercise05.py
File metadata and controls
40 lines (28 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from random import randrange, seed
from datetime import datetime
class Student:
def __init__(self, full_name):
self.full_name = full_name
self.grade = -1
def grade_student(student):
student.grade = randrange(0,11)
def average(students):
s = 0
for student in students:
s += student.grade
print("Average: " + str(s/len(students)))
seed(datetime.now())
names = ["Kirk Bowman",
"Bear Byers",
"Kurtis Macias",
"Maximus Preece",
"Cecily Ray",
"Cade Parry",
"Jordyn Pitts",
"Liya Christian",
"Ceri Orr",
"Mekhi Hahn"]
students = [Student(names[i]) for i in range(len(names))]
for student in students:
grade_student(student)
average(students)