Question: I need a python 3 help. from question 1.2, r.add_student(Student(White, Kate, 78787878, whitek@rt.edu)) >>> r.lookup(White) White, Ann -- Phone: 35435 Email Address: whitea@rt.edu White, Kate
I need a python 3 help.
from question 1.2,
r.add_student(Student("White", "Kate", 78787878, "whitek@rt.edu"))
>>> r.lookup("White")
White, Ann -- Phone: 35435
Email Address: whitea@rt.edu
White, Kate -- Phone: 78787878
Email Address: whitek@rt.edu
this part got me so stressful. I don't know how to return two students whose name is white.
Part 1. Classes
Question 1.1
Define a Student class that follows the doctests below:
class Student:
"""
>>> st1 = Student("Black", "John", 12345, "blackj@uscd.edu")
>>> print(st1)
Black, John -- Phone: 12345
Email Address: blackj@uscd.edu
>>> st2 = Student("White", "Ann", 35435, "whitea@rt.edu")
>>> print(st2)
White, Ann -- Phone: 35435
Email Address: whitea@rt.edu
"""
Question 1.2
Now you can use your Student class to create an rolodex for storing contacts of your friends. Your class should allow to add new students to rolodex,
search it for a friend, and view their contact information. You need to develop a Rolodex class, its behaviur should follow the doctests below. Hint: Python's built-in dictionaries might be useful.
class Rolodex:
"""
>>> r = Rolodex()
>>> r.add_student(Student("Black", "John", 12345, "blackj@uscd.edu"))
>>> r.add_student(Student("White", "Ann", 35435, "whitea@rt.edu"))
>>> r.lookup("Black")
Black, John -- Phone: 12345
Email Address: blackj@uscd.edu
>>> r.lookup("White")
White, Ann -- Phone: 35435
Email Address: whitea@rt.edu
>>> r.add_student(Student("White", "Kate", 78787878, "whitek@rt.edu"))
>>> r.lookup("White")
White, Ann -- Phone: 35435
Email Address: whitea@rt.edu
White, Kate -- Phone: 78787878
Email Address: whitek@rt.edu
"""
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
