Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Programmer:
- def __init__(self, name, language, skills):
- self.name = name
- self.language = language
- self.skills = skills
- def watch_course(self, course_name, language, skills_earned):
- if language != self.language:
- return f"{self.name} does not know {language}"
- self.skills += skills_earned
- return f"{self.name} watched {course_name}"
- def change_language(self, new_language, skills_needed):
- if self.skills >= skills_needed and new_language == self.language:
- return f"{self.name} already knows {new_language}"
- return f"{self.name} needs {skills_needed - self.skills} more skills"
- if self.skills >= skills_needed and new_language != self.language:
- previous_language = self.language
- new_language = self.language
- return f"{self.name} switched from {previous_language} to {new_language}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement