TypeError: unsupported format string passed to method.__format__
You need set value totale
by call the method, write
totale=data.total_interest(time)
# ^^^^^^
instead of
data.total_interest(time)
totale=data.total_interest
and the same in second case
time = dataa.time_required(total)
instead of
dataa.time_required(total)
time=dataa.time_require
In your definition, when you call the method you get a value, when you access to the method you get the description, for example:
In [14]: data.total_interest(time)
Out[14]: 2.8000000000000003
and
In [15]: data.total_interest
Out[15]: <bound method Calculator.total_interest of <__main__.Calculator object at 0x7f3e4c575668>>
TypeError: unsupported format string passed to NoneType.__format__ with f-string in Python
You would think that using an f-string would eliminate the need for an explicit call to str
, but the f-string construction gets re-routed to a call of b.__format__
.
You need to ensure b
is not None
by calling str
:
>>> f'{str(b):>11}'
' None'
Related Topics
How to Compare Two Image Files Contents in Python
Hiding Axis Text in Matplotlib Plots
Regex to Match Digits and At Most One Space Between Them
How to Flatten a Hierarchical Index in Columns
Pandas: Sum Dataframe Rows for Given Columns
Importerror: No Module Named Sklearn (Python)
Using Buttons in Tkinter to Navigate to Different Pages of the Application
Windowserror: [Error 126] the Specified Module Could Not Be Found
A Better Way Than Looping and Calling Functions That Loop and Call Another Functions
How to Move to One Folder Back in Python
Typeerror: Unsupported Operand Type(S) for ** or Pow(): 'List' and 'Int'
Python - Split a List of Dicts into Individual Dicts
How to Get Max() to Return Variable Names Instead of Values in Python
Pandas, Remove Everything After Last '_'
Permissionerror: [Errno 13] Permission Denied
How to Call Python Script on Excel Vba
How to Calculate a Gaussian Kernel Matrix Efficiently in Numpy