Python sin

The Python sin function calculates the Trigonometry Sine for the specified expression. This section discusses how to use the sin function with an example.

The mathematical formula behind the Sine function is the Length of the Opposite Side / Length of the Hypotenuse.

Python sin Syntax

The Sin function returns the value between -1 and 1. And the syntax of the sin Function in this Python Programming Language is


Number: It can be a number or a valid numerical expression for which you want to find the Sine value.

  • If the number argument is a positive or negative number, the sin function returns the Sine value.
  • If it is not a number, it returns TypeError.

Python sin Function Example

The Python sin Function allows you to find the trigonometry Sine for the numeric values. In this example, we are going to find the Sine values of different data types and display the output.

TIP: Please refer to asin article to find the Arc Sine of the specified Python expression.

First, We declared List and Tuple with some random values. Next, We used the Python sin Function directly on both the Positive integer and negative integer. The following statements find the Sine of the corresponding values. Next, We used it on Tuple and List items.

If you observe the above screenshot, this method is working perfectly on them.

Next, We used this math function on multiple values. Within the last statement, we tried on the String value, and it returns TypeError.

import math

Tup = (1, 2, 3, -4 , 5)
Lis = [-1, 2, -3.5, -4 , 5]

print('Sine value of Positive Number = %.2f' %math.sin(10))
print('Sine value of Negative Number = %.2f' %math.sin(-15))

print('Sine value of Tuple Item = %.2f' %math.sin(Tup[3]))
print('Sine value of List Item = %.2f' %math.sin(Lis[2]))

print('Sine value of Multiple Number = %.2f' %math.sin(10 + 20 - 40))
print('Sine value of String Number = ', math.sin('Hello'))
Python SIN Function