1 常量是什么
固定不变的量
2 定义常量
- 因为python中没有严格意义上的常量,如果你非要改,也可以,一定要记住,常量是约定俗成的,但是也可以更改,但是最好不要改。
- 变量名必须大写。
FANPING_HEIGHT = 150
# FANPING_HEIGHT = FANPING_HEIGHT + 1
# print(FANPING_HEIGHT)
151
3 注释是什么
3.1 不加注释
FANPING_HEIGHT = 150
FANPING_HEIGHT = FANPING_HEIGHT + 1
print(FANPING_HEIGHT)
151
3.2 加注释
FANPING_HEIGHT = 150
# FANPING_HEIGHT = FANPING_HEIGHT + 1
# print(FANPING_HEIGHT)
注释有什么用
取消python的语法,让#后面的字符变成普通的字符
name = 'nick'
height = 150 # 身高
weight = 160 # 体重
# for循环有什么用?
for i in(1,2,):
print(i)
1
2
# FANPING_HEIGHT = 150
# FANPING_HEIGHT = FANPING_HEIGHT + 1
# print(FANPING_HEIGHT)
4 多行注释
'''
FANPING_HEIGHT = 150
FANPING_HEIGHT = FANPING_HEIGHT + 1
print(FANPING_HEIGHT)
'''
1
1
"""
FANPING_HEIGHT = 150
FANPING_HEIGHT = FANPING_HEIGHT + 1
print(FANPING_HEIGHT)
"""
1
1
标签:03,FANPING,常量,150,HEIGHT,注释,print
From: https://www.cnblogs.com/yating10/p/17705244.html