文章目录
- 题目1
- 代码
- 实验结果
- 题目2
- 代码
- 实验结果
- 题目3
- 代码
- 实验结果
- 题目总结
题目1
编写代码创建一个名为Staff的类和方法__init__,以按顺序初始化以下实例属性:
-staff_number
-first_name
-last_name
-email
代码
class Staff:def __init__(self, staff_number, first_name, last_name, email):self.staff_number = staff_numberself.first_name = first_nameself.last_name = last_nameself.email = email
实验结果
题目2
With the class called Staff you defined.
Your task is to write code to create 3 Staff objects with the following details:
staffObj1: 100001, John, Lee, jl123@gmail.com
staffObj2: 100002, Mary, Zheng, maryz@gmail.com
staffObj3: 100003, Cindy, Wilson, cw456@hotmail.com
代码
class Staff:def