1.练习项目:

练习使用Python语言

2.开始练习

(1)源码 :

#优先级判断

#示例1

c = 10+2*10

print(c)

#示例2

c=16*(1>>2)

print(c)

#示例3

c=(4|1)<<3

print(c)

#示例4

c=(4|2)&1

print(c)

#示例5

c=not 4>5 and 2|4>5

print(c)

#示例6

if 4>5:

    print('4>5')

elif 4<5:

    print('4<5')

else:

    print('4=5')

(2)检验结果

对此代码进行检验,检验后无报错,运行此代码,运行结果正确。

(3)练习心得:

算术运算>位运算>逻辑运算位运算:&>^>|
逻辑运算:基本运算>not>and>or
if...elif...else

输入法 是否切换为英语模式;语法是否错误。

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐