变量,标识符,关键字
变量(Variable)在python中每个变量在使用前必须进行赋值,变量赋值后该变量才会被创建
使用 = 进行赋值 等号左边是变量的名字,等号右边是变量的值
变量名 = 值
等号两边各空一个空格 美观
名字变量 = "张三" # 中文变量命名只能在python3中使用,但是不推荐
print(名字变量)
实例1:学生注册
# 定义变量---学生学号
studentNo = '8633'
# 定义变量---学生密码
studentPassword = '123456'
# 使用print函数输出
print(studentNo)
print(studentPassword)
延展
1.print()函数可以一次输出多个变量,中间用"空格+逗号"隔开
print('学生学号:', studentNo, '学生密码:', studentPassword)
2.每次print输出都是默认换行的,如果不需要换行,可以讲end参数设置为''
print(studentNo, end='') #默认end='\n' 不需要换行改成 end=''
print(studentPassword)
3.在Python2.x版本中 print并不是有个函数.写法是print "hello world"
所以判断代码使用的Python版本的最直接方式是看print的格式,所以粘贴Python2的代码到Python3中无法运行是正常的
print &#