【发布时间】:2015-08-10 19:19:45
【问题描述】:
尝试用python做一个简单的计数器 对于“Learn Python Book”中的项目
简介:编写一个对用户有用的程序。 让用户输入起始号码, 结束号码和金额 数数。
到目前为止我所拥有的:
print ("Welcome to the program for those who are to lazy to count")
print ("You must be really really lazy too use this")
input ("\n Press any key to continue")
Num1 = input ("Please Enter Starting Number: \n")
Num2 = input ("Please Enter Ending Number: \n")
count = input ("Count up in: \n")
while (Num1 < Num2):
Num1 += count
print (Num1)
不确定这段代码有什么问题,它卡在无限循环中,有人能解释一下原因吗?并且可能是一个修复:) 卡住了
【问题讨论】:
-
提示:
"100" < "9"是真的。100 < 9是假的。 -
嗯,你能详细说明一下 Num1 和 Num2 是变量,所以如果我将它们放在 "" 引号内,它只会将它们视为字符串?
标签: python python-3.x counter