Python math.cos() Metode
Voorbeeld
Vind die cosinus van verskillende getalle:
# Import math Library
import math
# Return the cosine of
different numbers
print (math.cos(0.00))
print (math.cos(-1.23))
print (math.cos(10))
print (math.cos(3.14159265359))
Definisie en gebruik
Die math.cos()
metode gee die cosinus van 'n getal terug.
Sintaksis
math.cos(x)
Parameterwaardes
Parameter | Description |
---|---|
x | Required. A number to find the cosine of. If the value is not a number, it returns a TypeError |
Tegniese besonderhede
Terugkeerwaarde: | 'n float Waarde, van -1 tot 1, wat die cosinus van 'n hoek voorstel |
---|---|
Python weergawe: | 1.4 |