思考题解答与改变定式思维

各个语言都有长板和短板

动态语言的缺点,没有类型检查,有些细节不处理好,就会产生bug

input()返回的是str

a = input("请输入a的值:")
print(type(a))
a = int(a) # 将a转化为int

if a == 1:
    print("apple")
else:
    print("other")
请输入a的值:12
<class 'str'>
other

results matching ""

    No results matching ""