طريقة بايثون math.copysign ()
مثال
قم بإرجاع قيمة المعلمة الأولى وعلامة المعلمة الثانية:
#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 |