Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

323
Vistas
Python - How can I get the largest decimal of two decimals

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'
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can do this with the max function in the standard library:

max(option.principal.amount, max_monthly_amount.amount))
over 4 years ago · Santiago Trujillo Denunciar

0

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))
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda