如果想要创建一个类,需要用到哪个关键字

python2-lesson13

Quiz
•
Computers
•
3rd - 11th Grade
•
Medium

hang zheng
Used 32+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
def
class
open
for
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
创建一个类,哪个函数是必须的?
--init--(self)
__init__()
init(self)
__init__(self)
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
__init__(self)函数中的self代表什么?
代表每一个创建的实例对象
什么都不是,只是一个规范而已
代表类本身
代表一个传入的参数
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
阅读图中代码,现在如果想根据Car类创建一个实例,下列代码书写正确的是?
c=Car("red")
c=Car
c=Car()
c=Car(self)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
观察上图代码,现在需要创建一个Car类的实例,下列哪种方式是正确的。
c=Car()
c=Car(c,"red","电动车",4)
c=Car("red","电动车",4)
Car("red","电动车",4)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
现在已经存在一个People类,想要在类中增加一个新的方法,名字叫做playgame,下列代码正确的是?
def playgames(self):
def playgames():
def (playgames):
def ()playgames:
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
观察上图代码,c是Car类的一个实例,现在想打印出c中color属性,下列代码正确的是?
print(c)
print(Car.color)
print(c.color)
print(color)
Create a free account and access millions of resources
Similar Resources on Quizizz
10 questions
网络安全漏洞-Quiz

Quiz
•
1st - 5th Grade
7 questions
程序编码

Quiz
•
3rd Grade
10 questions
电脑程式语言(前测)

Quiz
•
1st - 5th Grade
11 questions
J10.3 网络的类型

Quiz
•
8th Grade
9 questions
5年级设计与工艺:单元3 我是小创客(1)

Quiz
•
5th Grade
10 questions
顺序结构复习

Quiz
•
10th Grade
11 questions
J04 互联网及其应用

Quiz
•
7th Grade
11 questions
2024年编程语言总结

Quiz
•
9th - 12th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade