Reputation: 13
i'm writing my first program in python. I have a function that should save a number in a txt file. This number is obtained with some math, converted in int, (just because i need only the integer part) then in string. Then saved into txt.
Here i just deleted the saving part and replaced with print.
str=140
str0 = float(str0)
str = float(str)
perc0 = 100-(str*100/str0)
perc0 = int(perc0)
perc0 = str(perc0)
print(perc0)
But the result is
File ".\temp.py", line 10, in <module>
perc0 = str(perc0)
TypeError: 'float' object is not callable
What am i doing wrong? Sorry for dumb question, but after some research i don't really know what's wrong, meybe i'm missing some basics
Upvotes: 0
Views: 50
Reputation: 128
str
is a keyword in python. You should avoid using that as a variable name.
Upvotes: 2