python基础-输入函数与运算符及其优先级
Python的input()函数获取字符串输入,需通过int()或float()转换类型。运算符包括算术、赋值、比较、布尔和位运算;and/or支持短路求值,&/|不短路;==比较值,is比较内存地址;运算符优先级依次为算术、位、比较、布尔、赋值。
1.Python的输入函数input()
如果需要整数型和浮点型,就需要将str类型通过int()函数或者float()函数进行类型转换
1
2
3
4
5
name = input("请输入姓名:")
age = int(input("请输入年龄:"))
weight = float(input("请输入体重:"))
print(type(name), name, t...