-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathstudentInfo.py
More file actions
76 lines (58 loc) · 1.6 KB
/
studentInfo.py
File metadata and controls
76 lines (58 loc) · 1.6 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
def main():
students = [
Student("Larsson", 37),
Student("BonJovi", 55),
]
printHeader()
selection = getUserSelection()
if selection == 0:
printStudentsByAge(students)
elif selection == 1:
pass
elif selection == 2:
pass
else:
print "SELECTION NOT RECOGNIZED"
class Student:
def __init__(self, lastName, age):
self.lastName = lastName
self.age = age
self.firstName = "JOHN"
def assignRandomName(self):
pass
def assignRandomAge(self):
self.age = random.randint(0,100)
def assignRandomWeight(self, isMetric):
pass
def assignRandomHeight(self, isMetric):
pass
inputQuestions = [
"For STUDENTS BY AGE, type 0",
"For STUDENTS BY LAST NAME, type 1",
"For STUDENTS BY FIRST NAME, type 3",
"For SUM of STUDENT AGES type 4",
"For AVERAGE of STUDENT AGES type 5",
]
def getUserSelection():
print (inputQuestions[0])
print (inputQuestions[1])
print (inputQuestions[2])
return input("Type selection and press enter:")
def printHeader():
print("HEADER TEXT HERE")
def printStudentsByAge(students):
print ("----Students By Age-----")
sortStudents = sorted(students, key=lambda student: student.age)
for student in students:
print student.lastName + ", " + student.firstName + ", " + str(student.age)
def printStudentsByLName(students):
print ("----Students By -----")
def printStudentsByFName(students):
print ("----Students By -----")
def printSumAge(students):
print ("Answer:")
def printAvgAge(students):
print ("Answer:")
def ageRange(studentA, studentB):
return math.abs(studentA.age - studentB.age)
main()