嘻皮客娱乐学习网

标题: 请用Python写一个获取用户输入数字,并根据数字大小输出不同信息的脚本 [打印本页]

作者: 785751397    时间: 2014-11-30 16:55
标题: 请用Python写一个获取用户输入数字,并根据数字大小输出不同信息的脚本
代码如下(Python 3.0 下调试通过)
x = int(input(“Please enter an integer:”))
if x < 0:
x = 0
print (‘Negative changed to zero’)
elif x == 0:
print (‘Zero’)
elif x == 1:
print (‘Single’)
else:
print (‘More’)




欢迎光临 嘻皮客娱乐学习网 (http://www.xipick.com/) Powered by Discuz! X3.3