-
Notifications
You must be signed in to change notification settings - Fork 0
/
teacher.py
48 lines (36 loc) · 1.22 KB
/
teacher.py
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
teachers = {'Jason Seifer': ['Ruby Foundations', 'Ruby on Rails Forms', 'Technology Foundations'],
'Kenneth Love': ['Python Basics', 'Python Collections']}
def most_classes(teachers):
max_lessons = 0
max_teacher = ""
for item in teachers:
print(item)
print(len(teachers[item]))
if len(teachers[item]) > max_lessons:
max_lessons = len(teachers[item])
max_teacher = item
return max_teacher
def num_teachers(teachers):
return len(teachers)
def stats(teachers):
list_of_teachers = []
for item in teachers:
print("The item is {}.".format(item))
print("The number of lessons is {}.".format(len(teachers[item])))
sub_list =list([item])
sub_list.append(len(teachers[item]))
print(sub_list)
list_of_teachers.append(sub_list)
return list_of_teachers
def courses(teachers):
list_of_courses = []
for item in teachers:
courses_list = teachers[item]
for f in courses_list:
if f not in list_of_courses:
list_of_courses.append(f)
return list_of_courses
print(most_classes(teachers))
print(num_teachers(teachers))
print(stats(teachers))
print(courses(teachers))