我不知道什么是错的。当我在左侧放置x * x,在右侧放置25时,它不起作用。 python shell显示没有错误,但在输入解决方案的数量后,没有任何反应。我认为它可能处于无限循环中,或者在每次运行后都不会应用x。请帮忙!这里是我的代码:Python中无限循环while循环
#getting input information
print
print "This program cannot solve for irrational or repeating numbers. Please round for them in your equation."
print
print "Make the variable in your equation stand for x"
print
startingLimit=int(raw_input("What is the lowest estimate that your variable could possibly be?"))
print
wholeNumber=raw_input("Do you know if your variable will be a whole number or a fraction? Answer: yes/no")
if (wholeNumber== "yes"):
print
fraction= raw_input("Is it a decimal/fraction? Answer:yes/no")
if (fraction=="yes"):
print
print "This program will only calculate up to the fourth place to the right of the decimal"
xfinder=0.0001
else:
xfinder=1
else:
xfinder=0.0001
x=0
leftEquation=raw_input("Enter your left side of the equation:")
print
rightEquation=raw_input("Enter the right side of the equation:")
print
amountSolutions=raw_input("How many solutions are there to your equation? (up to 20)")
#solving
indivisualCount=0
count=0
x=startingLimit
while (count!=amountSolutions):
while (count==0):
ifstuffleft=eval(leftEquation)
ifstuffright=eval (rightEquation)
if (ifstuffleft!=ifstuffright):
x=x+xfinder
else:
a=x
count=count+1
该程序应该做什么?在请求解决方案的数量后,任何地方都不会打印任何内容,所以不应该有任何输出。 –
这看起来像功课。如果是这样,请标记它。 – serk
@serk:家庭作业标签现在[正式弃用](http://meta.stackexchange.com/questions/147100/the-homework-tag-is-now-officially-deprecated),不应添加到问题 –