面试1

一:关系运算

1)6 or 2 > 1  结果:6

2)3 or 2 > 1  结果:3

3)0 or 5<4  结果:false

4)5<4 or 3     结果:3

5)2>1 or 6      结果:true

6)3 and 2>1      结果:true

7)0 and 3>1       结果:0

8)2>1 and 3       结果: 3

9)3>1 and 0       结果:false

3>1 and 2 or 2<3 and 3 and 4 or 3>2   结果:2

二:简述变量命名规范

答:①变量是什么?  变量:把程序运行的中间结果临时的存在内存里,以便后续的代码调用。

②变量的声明:name=”莉“变量名为name,变量值为莉,

③变量的作用:昵称,其代指内存里某个地址中保存的内容

④变量定义的规则:变量名只能是字母,数字,下划线的任意组合,变量名的第一个字符不能是数字,一下关键字不能声明为变量名【and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield'】变量的定义具有可表述性。

⑤变量的赋值:

Name1 = “联科”

Name2 = “物联网”

Name1 = “物联网”

Name2 = Name1

Name1和Name2在内存中都指向物联网

原文地址:https://www.cnblogs.com/twinkle-/p/10435680.html