【发布时间】:2015-03-13 19:39:30
【问题描述】:
from __future__ import division
import decimal
print "Type the total population"
a = float (raw_input())#population
print "type the number of seats"
b = raw_input()#seats
d = int(a) / int(b)
print "The Devisor is:",
print d
print "Type state population"
s = float (raw_input())
one = int(s) / int(d)
print "States standard quota is:",
print one
print "Type next states population"
s = float (raw_input())
two = int(s) / int(d)
print "States standard quota is:",
print two
print "Type next states population"
s = float (raw_input())
three = int(s) / int(d)
print "States standard quota is:",
print three
print "Type next states population"
s = float (raw_input())
four = int(s) / int(d)
print "States standard quota is:",
print four
print "Type next states population"
s = float (raw_input())
five = int(s) / int(d)
print "States standard quota is:",
print five
print "list of states standard quotas"
print one
print two
print three
print four
print five
x = int(one) + int(two) + int(three) + int(four) + int(five)
print "type decimals one at a time"
e = float (raw_input())
f = raw_input()
g = raw_input()
h = raw_input()
i = raw_input()
z = int(e) + int(f) + int(g) + int(h) + int(i) # This is where error is
print "distribute following from highest to lowest decimal"
print int(z)
raw_input("按任意键继续:")
在此处输入代码
----- 这是我为国会中代表分布的 Hamilton 方法制作的计算器代码,它可以节省我在数学上的时间,它让我可以练习一些我真正关心的东西。一切正常,直到我评论了#error。通常我会在 IDLE python shell 中进行测试,但由于 raw_inports 中需要输入,它无法工作。请记住,我对 python 很陌生,所以我知道我的代码很可能效率低下。此外,如果没有发生错误,我也遇到了 0 结果的问题,这应该是所有小数相加,等于 1 到 3 之间的一个小数(通常)
【问题讨论】:
-
我认为您没有将
#error放在代码中的任何位置... -
抱歉忘记了,深,刚刚编辑
-
我可以看到
#error评论。但更有用的是,如果你给我们实际的错误信息...... -
给出相关输出,包括错误信息和回溯
-
我希望可以,它会闪烁一秒钟然后崩溃。 AMD 似乎 raw inport 在 python IDE 环境中的东西 fir 测试代码中不起作用,如果我错了,很抱歉,非常新
标签: python