Python programming language provides users with lots of mathematical functions through the math module. However, a user can use these functions to perform calculations like the root square, logarithm, trigonometric operations and more which will be given in other lessons one after the other.
Consider the below codes:
1 Import math 2 Dsfsd 3 # Square root 4 Number = 16 5 Sqrt_result = math.sqrt(number) 6 Print(“Square Root:”,sqrt_result) 7 Sfsdfd 8 # Logarithm 9 Number = 10 10 Log_result = math.log(number) 11 Print(“Logarithm:”, log_result) 12 Sfsdsfs 13 # Trigonometric operation (sine) 14 Angle = math.radians(30) 15 Sin_result = math.son(angle) 16 Print(“Sine:”,sin_result)
When the above is run or executed, the output is supposed to be:
Square Root: 4.0
Logarithm: 2.302585092994046
Sine: 0.49999999999999994
NOTE:
Using the CODE EDITOR or the Visual Studio Code, input the above details and run it to obtain the given result as seen earlier.
Should you have any questions, please do not forget to leave such in the comment session.
About Author
Discover more from SURFCLOUD TECHNOLOGY
Subscribe to get the latest posts sent to your email.