打卡-2

1.这门语言为什么叫Python,不是pig?
Python 的名字来自于英国超现实主义喜剧团体,而不是来自于蛇。Python 程序
员被亲切地称为Pythonistas。Monty Python 和与蛇相关的引用常常出现在Python 的指南和文档中

2.交互式环境干嘛的?怎么用?
交互式环境让你每次执行一条Python 指令,并立即显示结果——人机对话
IDLE
pycharm

3.数学操作符//和/有什么区别?==和=有什么区别?
数学操作符包括加减乘除,开方,除法求整,除法求余
//代表除法求整数,/ 仅代表除法
‘= =’表示等于,一个=是赋值

4.如何在交互式环境下,实现等式【也就是求出商和余数】
打卡-2
print(10//3)
print(10%3)

5.如果一个变量名全部是大写,比如COUNTIME,这意味着什么?【请自己搜索资料】
表示为常量
6.input函数很好用,特别是当你不想要在代码中输入隐私信息,每次执一次性输入的时候!那么input怎么用呢?
input()
运行的时候输入符合条件的值,然后继续运行
7.我们用缩进表示代码块的层次,那么Python里一个缩进等于几个空格?
4个
但是可能要取决于个人习惯
python 要求代码必须有缩进,但是没有强制规定多少个缩进
8.break和continue区别?【博客园有很多资料】
break 和contiue都是在while里用的
碰到break终止循环,循环中后面的会跳过
预见continue则返回循环的开头,同样跳过continue后面的语句
9.如何导入模块?
import 模块名称
import this

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea – let’s do more of those!

10.每一个def定义函数一定要有return么?
不一定
比如 def hello:
print(‘hello,my friends’)
print(’ i’m ok ')
print(hello)

11.在函数中申明的变量可以不可以整个代码中都来使用?自己分情况理一下脉络
可以的
在def时,global 变量名

12.自己实猜数字的代码
【要求:将最终数字答案,也就是secrectNumber的值设置为自己的年纪,书上代码是把答案设置为一个1到20随机整数,如果你懂了,你应该知道怎么修改他,然后请你模拟猜数字的过程,直到猜出最后真实数字,(虽然这个数字就是你早就知道是你的年龄哈哈哈哈)】
打卡-2
打卡-2