Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 The difference between two functions
#3
Yes. You can always use the type function to test that.
Examples (Out[10] is the output for the line of code above it):
from decimal import Decimal

2/5
Out[10]: 0.4

type(2/5)
Out[11]: float

Decimal(2/5)
Out[12]: Decimal('0.40000000000000002220446049250313080847263336181640625')

type(Decimal(2/5))
Out[13]: decimal.Decimal

2//5
Out[14]: 0

type(2//5)
Out[15]: int

Quote

Top Page

Messages In This Thread
RE: The difference between two functions - by midarq - Dec-03-2019, 12:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)