पायथन गणित.ट्रंक () विधि
उदाहरण
विभिन्न संख्याओं का पूर्णांक भाग ज्ञात कीजिए:
# Import math Library
import math
# Return the truncated integer
parts of
different numbers
print(math.trunc(2.77))
print(math.trunc(8.32))
print(math.trunc(-99.29))
परिभाषा और उपयोग
यह math.trunc()
विधि किसी संख्या का छोटा किया गया पूर्णांक भाग लौटाती है।
नोट: यह विधि संख्या को ऊपर/नीचे निकटतम पूर्णांक तक नहीं घुमाएगी, बल्कि दशमलव को हटा देगी।
वाक्य - विन्यास
math.trunc(x)
पैरामीटर मान
Parameter | Description |
---|---|
x | Required. The number you want to remove the decimal part of. If the value is not a number, it returns a TypeError |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | एक int मान, किसी संख्या के काटे गए पूर्णांक भागों का प्रतिनिधित्व करता है |
---|---|
पायथन संस्करण: | 1.4 |