Radians () method for converting degrees to radians in Python

Source: Internet
Author: User
This article mainly introduces the radians () method for converting degrees to radians in Python. It is the basic knowledge in Python. For more information, see radians () method to convert the angle to radian angle x.
Syntax

The following is the syntax of the radians () method:

radians(x)

Note: This function cannot be directly accessed. Therefore, we need to import the math module and then use the static object of math to call this function.
Parameters

  • X -- this must be a value.

Return Value

This method returns the radians of an angle.
Example

The following example shows how to use the radians () method.

#!/usr/bin/pythonimport mathprint "radians(3) : ", math.radians(3)print "radians(-3) : ", math.radians(-3)print "radians(0) : ", math.radians(0)print "radians(math.pi) : ", math.radians(math.pi)print "radians(math.pi/2) : ", math.radians(math.pi/2)print "radians(math.pi/4) : ", math.radians(math.pi/4)

When we run the above program, it will produce the following results:

radians(3) : 0.0523598775598radians(-3) : -0.0523598775598radians(0) : 0.0radians(math.pi) : 0.0548311355616radians(math.pi/2) : 0.0274155677808radians(math.pi/4) : 0.0137077838904
Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.