8000 Updated questions · zfoxpython/intro-to-python@f64a439 · GitHub
[go: up one dir, main page]

Skip to content

Commit f64a439

Browse files
committed
Updated questions
1 parent 7564638 commit f64a439

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

session_10/answers/A3.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ def set_bonus(self, bonus):
2424
employee1.set_department("Technology")
2525
employee1.display_info()
2626

27-
# - ii. Create the instance attributes fullname and email in the Employee class.
27+
# - ii. Create the instance attributes first name and last name instead of name.
28+
# - Create two methods full_name and email_address in the Employee class.
2829
# - Given a person's first and last names:
29-
# - Form the fullname by simply joining the first and last name together, separated by a space.
30-
# - Form the email by joining the first and last name together with a . in between, and follow it with @company.com at the end. Make sure everything is in lowercase.
30+
# - Form the full_name method by simply joining the first and last name together, separated by a space.
31+
# - Form the email_address by joining the first and last name together with a . in between, and follow it with @company.com at the end. Make sure everything is in lowercase.
3132

3233
class Employee:
3334
def __init__(self, first_name, last_name, staff_number):

session_10/exercises/exercises_10.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,24 @@
88
- Circumference = 2πr
99
- Use the round() function to get the answer to 2 decimal places
1010

11-
3. Create a Vehicle parent class, initialise it with, wheels, colour and a method to display all this information.
11+
3. Create a Employee class and initialise it with name and staff number.
12+
- i. Make methods to:
13+
- display_info - It should display all the information of the employee.
14+
- set_department - It should assign the department to employee.
15+
- set_bonus - It should assign a bonus amount to the employee.
16+
17+
- ii. Create the instance attributes first name and last name instead of name.
18+
- Create two methods full_name and email_address in the Employee class.
19+
- Given a person's first and last names:
20+
- Form the full_name method by simply joining the first and last name together, separated by a space.
21+
- Form the email_address by joining the first and last name together with a . in between, and follow it with @company.com at the end. Make sure everything is in lowercase.
22+
23+
24+
4. Create a Vehicle parent class, initialise it with, wheels, colour and a method to display all this information.
1225
- i. Create a Tesla (or any car) child classs and add a method to get the miles and a method to display all this information.
1326
- ii. Change the colour of the vehicle.
1427
- iii. Delete the wheels.
1528

16-
4. Create a Employee class and initialise it with name and staff number. Make methods to:
17-
- display_info - It should display all the information of the employee.
18-
- set_department - It should assign the department to employee.
19-
- set_bonus - It should assign a bonus amount to the employee.
2029

2130
5. Create the instance attributes fullname and email in the Employee class. Given a person's first and last names:
2231
- Form the fullname by simply joining the first and last name together, separated by a space.

0 commit comments

Comments
 (0)
0