…1… #不能作为变量名的关键字
import keyword
print(keyword.kwlist)
输出不能作为变量的关键词:
[‘False’, ‘None’, ‘True’, ‘and’, ‘as’, ‘assert’, ‘break’,‘class’, ‘continue’, ‘def’, ‘del’, ‘elif’, ‘else’, ‘except’, ‘finally’, ‘for’, ‘from’, ‘global’, ‘if’, ‘import’, ‘in’, ‘is’, ‘lambda’, ‘nonlocal’, ‘not’, ‘or’, ‘pass’, ‘raise’, ‘return’, ‘try’, ‘while’, ‘with’, ‘yield’]
…2… type
price=input("请输入单价:") #输入
print('您刚才输入的是',price) #输出
print(type(price)) #判断类型
…3…
price=input("请输入单价:") #输入的是字符串
x=int(price) #强制类型转换:转化成整型
print(x,type(x)) #输出x,并判断x的类型
price2=input('请输入斤数')
y=float(price2) #强制类型转换:转化成浮点型
print(y