Created
June 24, 2020 09:22
-
-
Save mertdotcc/094152607b09b42e4a6d88fa4e53a7b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Student(): | |
def __init__(self, first_name, last_name, birth_year, emergency_contact): | |
self.first_name = first_name | |
self.last_name = last_name | |
self.birth_year = birth_year | |
self.emergency_contact = emergency_contact | |
@classmethod | |
def from_string(cls, student_string): | |
first_name, last_name, birth_year, emergency_contact = student_string.split("-") | |
return cls(first_name, last_name, birth_year, emergency_contact) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment