【发布时间】:2015-04-18 14:29:37
【问题描述】:
每当我使用 time 包时,我都会收到此错误:
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)
【问题讨论】:
标签: time python-3.x