每当我使用时间包时,都会收到此错误:
Traceback (most recent call last):
File "C:\Python34\2015\intrest calculator.py", line 53, in <module>
time.sleep(1)
AttributeError: 'float' object has no attribute 'sleep'
这是我的代码:
import time
while True:
choice = input("will you like to calculate simple or compound intrest:")
if choice == "simple intrest":
userData(choice)
time = time/12
intrest = principal * time * intrestRate
intrest = round(intrest, 2)
balance = principal + intrest
balance = round(balance, 2)
balance = str(balance)
intrest = str(intrest)
print("your intrest is: %" + intrest)
time.sleep(1)
print("your final balance is $" + balance)
答案 0 :(得分:0)
对于遇到同样问题的其他人,请确保您的所有变量都不与您的任何软件包相同。
对不起伙计们,这是我的坏事。
应该从一开始就看到了