-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcourses.py
More file actions
37 lines (36 loc) · 1.28 KB
/
courses.py
File metadata and controls
37 lines (36 loc) · 1.28 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
#!/usr/local/bin/python3
def description(name, instructor, *students, **staff):
"""Print out a course description.
name: Name of the course
instructor: Name of the instructor
*students, ...: List of student names (positional arguments)
**staff, ...: List of additional staff (keyword arguments)
"""
print("=" * 40)
print("Course Name:", name)
print("Instructor:", instructor)
print("-" * 40)
for title, name in staff.items():
print(title.capitalize(), ": ", name)
print("---------- registered students ----------")
for student in students:
print(student)
if __name__ == "__main__":
description("Python 101",
"Steve Holden",
"Georgie Peorgie",
"Mary Lamb",
"Penny Rice",
publisher="O'Reilly School of Technology",
author="Python Software Foundation"
)
description("Django 101",
"Jacob Kaplan-Moss",
"Baa-Baa Blacksheep",
"Mary Contrary",
"Missy Muffet",
"Peter Piper",
publisher="O'Reilly School of Technology",
author="Django Software Foundation",
editor="Daniel Greenfield"
)