पायथन गणित। कॉपीसाइन () विधि
उदाहरण
पहले पैरामीटर का मान और दूसरे पैरामीटर का चिह्न लौटाएं:
#Import math Library
import math
#Return the value of the first
parameter and the sign of the second parameter
print(math.copysign(4, -1))
print(math.copysign(-8, 97.21))
print(math.copysign(-43, -76))
परिभाषा और उपयोग
math.copysign()
विधि पहले पैरामीटर के मान और दूसरे पैरामीटर के चिह्न (+/-) से युक्त एक फ्लोट लौटाती है ।
वाक्य - विन्यास
math.copysign(x, y)
पैरामीटर मान
Parameter | Description |
---|---|
x | Required. A number. The return will have the value of this parameter |
y | Required. A number. The return will have the sign (+/-) of this parameter |
टेक्निकल डिटेल
प्रतिलाभ की मात्रा: | एक float मान, जिसमें पहले पैरामीटर का मान होता है, और दूसरे पैरामीटर का चिह्न होता है |
---|---|
पायथन संस्करण: | 2.6 |