Python 代码输入 30 50 输出 80 错误分析与修正
下面程序输入是 30 50,输出是 80。
m,n=int(input().split()) print(m+n)
为什么是错的?
应该将 input() 的结果转换为 int 类型后再进行拆分,代码应该改为:
m,n=map(int,input().split()) print(m+n)
原文地址: https://www.cveoy.top/t/topic/f1vu 著作权归作者所有。请勿转载和采集!
安全问答是一个知识全球问答,包含丰富的问答知识
下面程序输入是 30 50,输出是 80。
m,n=int(input().split()) print(m+n)
为什么是错的?
应该将 input() 的结果转换为 int 类型后再进行拆分,代码应该改为:
m,n=map(int,input().split()) print(m+n)
原文地址: https://www.cveoy.top/t/topic/f1vu 著作权归作者所有。请勿转载和采集!