基础语法第七关小测

感谢您能抽出几分钟时间来参加本次答题,现在我们就马上开始吧!
定义一个Hello类如下,选项中代码能正常执行的是
代码:
class Hello():
    def __init__(self,name):
        self.name=name
    def showInfo(self):
        print(self.name)
A、h = Helloh.showInfo()
B、h = Hello()h.showInfo(‘张三’)
C、h = Hello(‘张三’)h.showInfo()
D、h = Hello(‘admin’)showInfo
请看如下代码,请补充代码,打印 “该圆的面积为78.5cm²”,请选出正确的代码组合(多选题,该题有两个答案)
代码:
π = 3.14
def circle(r):
    S = π * r * r
    (1)————————————————
(2)—————————————————————
A、print(该圆的面积为{}cm².format(S))
B、circle(5)
C、circle()
D、return(S)
E、print(该圆的面积为{}cm².format(circle(5)))

2题 | 被引用0次

使用此模板创建