变量的创建
price = 10.5
weight = 7.5
money = price*weight
print('总消费是%.2f元'%money)
变量的修改
year = 2023
print(year)
year = 2024
print(year)
money = 10
money = '10元'
print(money)
快速注释:CTRL+左斜杠/
price = 10.5
weight = 7.5
money = price*weight
money = money-5
print('总消费是%.2f元'%money)
常量
好好起名字,以免有歧义
变量的类型
a = '34iugi'
print(type(a))
a = '34iugi'
print(type(a))
print(isinstance(a,str))
标签:变量,weight,money,price,year,print,python2
From: https://blog.csdn.net/qq_42547097/article/details/141401068