Hi, I'm kinda new to programming and I'm doing a budget thing just to practice. I'm using a while loop to add the money used by the person. Here's my code so that you understand.
def moneyused(): moneyused = [] while True: used=float(input("Type the money you've used, if done, type '0':")) if used()==0: break else: moneyused.append(used) totalused = sum(moneyused) print ("You've used $",totalused,"in total.") I'm trying to make it so that with a trigger word the loop stops, but I can't use a word since I'm using floats in the input. So I try using a number but every time I type anything I get this error:
Traceback (most recent call last): File "<ipython-input-34-b805c6c03014>", line 1, in <module> moneyused() File "C:\Users\joner\Desktop\Python\Invento.py", line 42, in moneyused TypeError: 'int' object is not callable How can I get around is?
https://stackoverflow.com/questions/66485289/typeerror-float-object-is-not-callable-when-using-a-while-loop-to-make-it-end March 05, 2021 at 09:06AM
没有评论:
发表评论