2015-04-18 73 views
-1

每当我在使用的时候包有问题,我得到这个错误:即时通讯使用的时间包

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

对不起你们,只是想出了我的错误。

对于有同样问题的其他人,确保你的变量没有任何与你的软件包相同。

对不起,这是我的坏。

应该看到从一开始