# Python Math: Convert Polar coordinates to rectangular coordinates

## Python Math: Exercise-35 with Solution

Write a Python program to convert Polar coordinates to rectangular coordinates.

**Sample Solution**:-

**Python Code:**

```
import cmath
cn = complex(3,4)
# get polar coordinates
print("Polar Coordinates: ",cmath.polar(cn))
# polar to rectangular. Format for input is (length, ‹angle in radians›).
#Returns a complex number
cn1 = cmath.rect(2, cmath.pi)
print("Polar to rectangular: ",cn1)
```

Sample Output:

Polar Coordinates: (5.0, 0.9272952180016122) Polar to rectangular: (-2+2.4492935982947064e-16j)

**Flowchart:**

**Python Code Editor:**

**Have another way to solve this solution? Contribute your code (and comments) through Disqus.**

**Previous:** Write a Python program to get the length and the angle of a complex number.

**Next:** Write a Python program to find the maximum and minimum numbers from the specified decimal numbers.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

## Python: Tips of the Day

**Given each iterable to construct a tuple by adding an index:**

>>> a = ['Hello', 'world', '!'] >>> list(enumerate(a)) [(0, 'Hello'), (1, 'world'), (2, '!')]

**Weekly Trends**- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook