Python 测验 Python 测验


x = True
y = False
z = False

if x or y and z:
    print("yes")
else:
    print("no")
x = True
y = False
z = False

if not x or y:
    print(1)
elif not x or not y and z:
    print(2)
elif not x or y or not y and x:
    print(3)
else:
    print(4)

Python 测验 - 操作符

$(function() { code1= '
' + $("#py-qa-1").html() + '
'; code2= '
' + $("#py-qa-2").html() + '
'; $('#quiz').quiz({ counterFormat: '第 %current 题,共 %total 题', resultsFormat: '回答正确 %score 题,总共 %total 题!', nextButtonText: '下一题', finishButtonText: '完成', restartButtonText: '重新测验', questions: [ { 'q': 'x 的 y 次方(xy) 以下表达式正确的是?', 'options': [ 'x^y', 'x**y', 'x^^y', 'Python 没有提到' ], 'correctIndex': 1, 'correctResponse': '回答正确。', 'incorrectResponse': '回答错误,正确的是 x**y。' }, { 'q': ' 22 % 3 表达式输出结果为?', 'options': [ '7', '1', '0', '5' ], 'correctIndex': 1, 'correctResponse': '回答正确。', 'incorrectResponse': '回答错误,正确的是 1.' }, { 'q': '3*1**3 表达式输出结果为?', 'options': [ '27', '9', '3', '1' ], 'correctIndex': 2, 'correctResponse': '回答正确。', 'incorrectResponse': '回答错误,正确的是 3。** 拥有更高的优先级。' }, { 'q': '9//2 表达式输出结果为?', 'options': [ '1', '2', '3', '4' ], 'correctIndex': 3, 'correctResponse': '回答正确,// 用于向下取接近除数的整数。', 'incorrectResponse': '回答错误,正确的为 4,// 用于向下取接近除数的整数。' }, { 'q': '如果表达式的操作符有相同的优先级,则运算规则是?', 'options': [ '左到右', '右到左', '看心情', ], 'correctIndex': 0, 'correctResponse': '回答正确。', 'incorrectResponse': '回答错误,正确的为左到右。' }, { 'q': code1 + '

以上代码输出结果为?

', 'options': [ 'yes', 'no', '编译出错' ], 'correctIndex': 0, 'correctResponse': '回答正确,and 拥有更高优先级,会先行运算。', 'incorrectResponse': '回答错误,and 拥有更高优先级,会先行运算。' }, { 'q': code2 + '

以上代码输出结果为?

', 'options': [ '1', '2', '3', '4' ], 'correctIndex': 2, 'correctResponse': '回答正确,优先级顺序为 NOT、AND、OR。', 'incorrectResponse': '回答错误,优先级顺序为 NOT、AND、OR。' }, ] }); })

Python 测验 Python 测验