简答题

请说明类属性和实例属性的区别

下载APP答题
由4l***1u提供 分享 举报 纠错

相关试题

单选题 以下关于模块说法错误的是( )

A、 一个xx.py就是一个模块
B、 任何一个普通的xx.py文件可以作为模块导入
C、 模块文件的扩展名不一定是.py
D、 运行时会从制定的目录搜索导入的模块,如果没有,会报错异常

单选题 下面不符合Python语言命名规则的变量名是( )

A、monthly
B、monthl3
C、3monthly
D、_Monthly3_

单选题 在Python中,如何将字符串转换为整数?( )

A、str()
B、int()
C、float()
D、以上都不是

单选题 在Python中,不同的数据,需要定义不同的数据类型,可用方括号[ ]来定义的是( )

A、列表
B、元组
C、集合
D、字典

单选题 在下列语句中不能创建一个字典的语句是()

A、 Dict1 = {}
B、 dict2 = {4:6}
C、 Dict3 = dict([2,5],[3,4]}
D、 dict4 = dict(([1,2],[3,4]))

单选题 定义类如下:
Class Hello():
Def __init__(self,name)
Self.name=name
Def showInfo(self)
Print(self.name)
下面代码能正常执行的是()。

A、 h = Hello
(h.showInfo() )
B、 h = Hello()
(h.showInfo(‘张三’))
C、 h = Hello(‘张三’)
(h.showInfo() )
D、 h = Hello(‘admin’)
(showInfo)

单选题 下列选项中,用于格式化字符串的是( )。

A、 %
B、format()
C、f-string
D、以上全是

单选题 下列哪个选项可以用于导入模块?( )

A、 import math as m
B、 include math as m
C、 #include <math.h>
D、 #import<math.h>