单项选择题
在Python中,如何检查一个变量是否为None?()
A.variable is None
B.variable ==None
C.variable ===None
D.A和B都对
点击查看答案&解析
相关考题
-
单项选择题
在Python中,如何使用装饰器?()
A.@decorator def func():pass
B.def func()decorator:pass
C.func =decorator(func)
D.A和C都对 -
单项选择题
在Python中,如何创建一个生成器函数?()
A.def func():yield x
B.function*func(){yield x;}
C.generator func(){yield x;}
D.func =generator(x for x in range(10)) -
单项选择题
在Python中,如何使用条件表达式(三元运算符)?()
A.x if condition else y
B.condition ?x :y
C.if condition:x else:y
D.condition then x else y
