python程序没有开始调试

2024-04-19 20:58:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我对python和编程都很陌生,我的家庭作业是在python2.7pyscripter上写一个程序。一旦我写了程序,我点击run,它要求我输入用户信息。之后什么也没发生,它说调试正在进行中。我等了,但什么也没发生。 代码如下:

in_balance = float(raw_input("Enter the outstanding balance on your credit card"))
int_rate = float(raw_input('Annual interest rate as decimal'))
min_month_pay = 0
month_int_rate = int_rate/12
month = 0
balance = in_balance

while balance > 0:
    month = 0
    balance = in_balance
    min_month_pay = min_month_pay + 10
    while month < 12 and balance > 0:
        month = month + 1
        interest = month_int_rate * balance
        balance = balance + interest
balance = round(balance, 2)
print 'result'
print 'month pay to pay off in 1 year: $', min_month_pay
print 'number of months needed: ', month
print 'Balance: $', balance

Tags: in程序inputrawrate编程floatmin
1条回答
网友
1楼 · 发布于 2024-04-19 20:58:03

正如bogatron所说,只要处于平衡状态>;0,就有一个无限循环。我不熟悉pyscripter,但是如果它和其他调试器一样,如果它在执行任何代码,就会说“debugging”。如果您暂停t,您会看到它停在while循环中的某一行。不确定尝试的功能是什么,但我不确定为什么要从while循环开始,因为即使没有每次重新分配平衡,平衡也不会减少。你知道吗

相关问题 更多 >