Hello!
Today I will solve this question!
Create a class
Employee
that will take a full name as argument, as well as a set of none, one or more keywords. Each instance should have aname
and alastname
attributes plus one more attribute for each of the keywords, if any.Examples
john = Employee("John Doe") mary = Employee("Mary Major", salary=120000) richard = Employee("Richard Roe", salary=110000, height=178) giancarlo = Employee("Giancarlo Rossi", salary=115000, height=182, nationality="Italian") john.name ➞ "John" mary.lastname ➞ "Major" richard.height ➞ 178 giancarlo.nationality ➞ "Italian"
And this is my solved code!
First, the first name and the last name is the name splited.
Wendy (Split) Nickel
Next, we have the variable salary.
Put the salary into the self.salary.
Height, nationality, and subordinates is also same!
Put the (height, nationality subordinates) into the self.(height, nationality subordinates) .
That was really easy!
Bye!!!
0 件のコメント:
コメントを投稿