我在使用时间包时遇到问题
Im having trouble using the time package
每当我使用时间包时,我都会收到此错误:
Traceback (most recent call last):
File "C:\Python3415\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)
对不起各位,我才发现我的错误。
对于遇到相同问题的任何其他人,请确保 none 的变量与您的任何包相同。
对不起各位,是我的错。
应该从一开始就看到了
每当我使用时间包时,我都会收到此错误:
Traceback (most recent call last):
File "C:\Python3415\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)
对不起各位,我才发现我的错误。
对于遇到相同问题的任何其他人,请确保 none 的变量与您的任何包相同。
对不起各位,是我的错。
应该从一开始就看到了