python基础练习题库实验7

文章目录

  • 题目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_number
        self.first_name = first_name
        self.last_name = last_name
        self.email = email

实验结果

python基础练习题库实验7_第1张图片

题目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, [email protected]
staffObj2: 100002, Mary, Zheng, [email protected]
staffObj3: 100003, Cindy, Wilson, [email protected]

代码

class Staff:
    def 

你可能感兴趣的:(python考试复习小题库,python,开发语言)