Reputation: 1786
I have two values of type decimal i.e <class 'decimal.Decimal'> and <class 'decimal.Decimal'>
and the numbers are
print(option.principal.amount, 'and', max_monthly_amount.amount)
Outputs
500000.00 and 500000
Getting max of the two values like this
option.principal.amount.max(max_monthly_amount.amount)
Returns
'decimal.Decimal' object has no attribute 'max_term'
Upvotes: 1
Views: 217
Reputation: 2145
You can do this with the max
function in the standard library:
max(option.principal.amount, max_monthly_amount.amount))
Upvotes: 8
Reputation: 1
you should convert both of them to float and then use max function this way :
num1 = float(option.principal.amount)
num2 = float(max_monthly_amount.amount)
print(max(num1, num2))
Upvotes: -1