White school python-day03- digit system variables, user input, if else

Today is the day03, the following is a summary of learning.

But the line efforts, Mowen future.

---------------------------------------------------------------------------------------------------------------------------------------------------------------

Systems digits:

32bit = maximum memory address space is 2 ** 32 (B) i.e. 4294967296 B = 4GB, 4GB of memory maximum support so 32bit.

64bit = maximum memory address space is 2 ** 64 (B) i.e. 18446744073709551616 B = 17179869184GB, but actually not support such a large memory, the memory board supports the largest is more than 100 GB.

hard disk:

Mechanical hard drive:

5400 revolutions per minute = Cycling =
7200 = = per minute electric bike
10,000 revolutions per minute = fast electric car ride =
15,000 revolutions per minute = = mechanical hard drive motorcycle of fastest

Solid State Drive SSD = Tesla =

---------------------------------------------------------------------------------------------------------------------------------------------------------------

 python3.x compared python2.x different:

1. Default support Chinese
2. incompatible 2.x
3. core syntax adjustment, easier to learn
4. New features by default only on 3.x

---------------------------------------------------------------------------------------------------------------------------------------------------------------

Python.exe click on the following screen, this is the interactive mode.

 

Note: If the C disk can not be written documents

Run as administrator CMD

Input command: icacls d: \ / setintegritylevel M

Wait about one minute to complete the implementation of the program.

Call the python command line execution document:

= Change Directory cd
dir = view a list of files in the current directory

cd .. 返回上一层目录
cd ../.. 返回上上一层目录
cd ../../.. 返回上上上一层目录
cd ../../../.. 返回上上上上一层目录

图片表示从C盘到D盘。

用python执行其他盘的文档:(python程序在D盘,待执行文档在C盘)

---------------------------------------------------------------------------------------------------------------------------------------------------------------

后缀名,用于区分文件类型

.txt 记事本文本文件
.doc word文件
.xls excel文件
.ppt PPT文件
.exe 可执行文件
.jpg .png .jpeg 图片文件
.gif 动态图片
.pdf PDF文件
.mp4 .avi 视频
.py python文件
.java java 文件
.c .h c源码
.php php文件
.js javascript文件

---------------------------------------------------------------------------------------------------------------------------------------------------------------

环境变量:(命令行直接输入相应名称即可执行程序,不用输入路劲。)

当要求系统运行一个程序而没有告诉它程序所在的完整路径时,系统除了在当前目录下面寻找此程序外,还应到path中指定的路径去找。

用户通过设置环境变量,来更好的运行进程

 computer-属性-高级系统设置-环境变量-系统变量-path-编辑-新建 即可。

---------------------------------------------------------------------------------------------------------------------------------------------------------------

变量:

1.变量是用来存东西的

2.变量名只能包含字母、数字和下划线。变量名可以字母或下划线打头,但不能以数字打头。

3. 变量名不能包含空格,但可使用下划线来分隔其中的单词。

不要将Python关键字和函数名用作变量名,即不要使用Python保留用于特殊用途的单词。

 

以下关键字不能声明为变量名
['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']

 

4.变量名尽量使用英文,不用汉字或拼音。

5.如果要定义一个常量,则变量名全部大写,即告诉这个变量不要更改(原则是可以改的)。

运行结果:

---------------------------------------------------------------------------------------------------------------------------------------------------------------

字符编码

支持中文的第一张表就叫 GB2312
1980 gb2312 6700+(可支持汉字字数)
1995 gbk1.0 20000
2000 gb18030 27000
big5 台湾
unicode 万国码 支持所有国家和地区的编码 2**16 = 65535 = 存一个字符 统一占用2个字节
UTF-8 = unicode 的扩展集,可变长的字符编码集
Assic -->Gb2312 ->gbk1.0-->gb18030
Assic -->unicode -->utf-8 /utf-16
unicode 是向下兼容gb2312 , gbk

---------------------------------------------------------------------------------------------------------------------------------------------------------------

注释
单行注释 用#
多行注释用三个单引号或三个双引号 '''被注释的内容'''

---------------------------------------------------------------------------------------------------------------------------------------------------------------

用户输入:

input 接受的所有数据被当作字符串来处理
即便你输入的是数字,但依然会被当成字符串来处理。
int integer=整数 把字符串转换为数字用int,int(要转换的数据)
str string=字符串 把数字转换成字符串用str,str(要转换的数据)

运行结果:

---------------------------------------------------------------------------------------------------------------------------------------------------------------

双等号是等于,单等号是赋值,!=是不等于。

---------------------------------------------------------------------------------------------------------------------------------------------------------------

 

If else:

 1.缩进级别必须要保持一致,但是Windows上的TAB健和Linux上的TAB键不是一样的,

为了防止Windows上的代码放到Linux上乱码,所以统一打成四个空格,为了便捷于是将按键TAB设置为四个空格来使用。

2.else不能单独使用,必须和同级的if连着。

3.在if下面继续判断的时候应该用elif(意思就是else if)elif 就是当走到符合查询条件的语句后,后面所有的elif和else就不会再被执行。

 

 

 

 

Guess you like

Origin www.cnblogs.com/zrh058/p/11222920.html