01.注释、标识符
### 第一个程序
print('Hello World')
### 注释
单行注释 #
多行注释 ''' ''' 或 """ """
标识符
是给一些对象引用时起的名字
命名规则
-
只能由字母,数字,下划线组成
-
数字不能开头
-
不能为系统的关键字
-
大小写敏感
-
见名知意
命名规范
-
下划线连接 max_value
-
驼峰命名
-
大驼峰 MaxValue
-
小驼峰 maxValue
-
系统关键字(保留字)
查看系统关键字
import keyword
print(keword.kwlist)
>>> and、exec、not、assert、finally、or、break、for、pass、class、from 、print、continue、global、 raise、def、if、 return、del、import、try、elif、in 、while、else、is、with、except、lambda、yield
输入函数
input( )
-
不论在键盘输入的值为什么东西,都是以str来接收的
-
如果需要进行数学运算,需要做响应的类型转换处理
输出函数
print( )
-
默认在控制台打印,也可以指定打印地点
-
默认情况下, 换行输出
取消print( )的换行
print('HelloWorld!', end='')

浙公网安备 33010602011771号