Easy Tutorial
❮ Python Att Time Clock Python String Expandtabs ❯

Python3 sin() Function

Python3 Numbers


Description

The sin() function returns the sine of x radians.


Syntax

Here is the syntax for the sin() method:

import math

math.sin(x)

Note: The sin() function cannot be accessed directly. It requires importing the math module and calling this method via the math static object.


Parameters


Return Value

Returns the sine of x radians, a value between -1 and 1.


Example

The following example demonstrates the use of the sin() method:

#!/usr/bin/python3
import math

print("sin(3) : ", math.sin(3))
print("sin(-3) : ", math.sin(-3))
print("sin(0) : ", math.sin(0))
print("sin(math.pi) : ", math.sin(math.pi))
print("sin(math.pi/2) : ", math.sin(math.pi/2))

The output of the above example is:

sin(3) :  0.1411200080598672
sin(-3) :  -0.1411200080598672
sin(0) :  0.0
sin(math.pi) :  1.2246467991473532e-16
sin(math.pi/2) :  1.0

Python3 Numbers

❮ Python Att Time Clock Python String Expandtabs ❯