# Math

{% embed url="https://www.hackerrank.com/domains/python?badge_type=python&filters%5Bsubdomains%5D%5B%5D=sets&filters%5Bsubdomains%5D%5B%5D=py-math" %}

## Mod Divmod

### What's divmod

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FAMKhcAlREUHO3EjccNOK%2Fimage.png?alt=media&#x26;token=af586eaf-126b-49eb-bfe0-bb87acb76c72" alt=""><figcaption></figcaption></figure>

### Task

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FNHBUrGgl5h7sCsqgwEpP%2Fimage.png?alt=media&#x26;token=f3a9c48f-9551-4a5a-82ca-4f01b71815bd" alt=""><figcaption></figcaption></figure>

### Solution

{% code lineNumbers="true" %}
```python
a = int(input())
b = int(input())

print(a // b)
print(a % b)
print(divmod(a, b))
```
{% endcode %}

***

## Polar Coordinates

### What is Polar Coordinates

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FVGsCYpcTVuOBRXv6sYyK%2Fimage.png?alt=media&#x26;token=43e84e71-38e0-4715-896e-a097721073f3" alt=""><figcaption></figcaption></figure>

### Pythons mathematical functions for complex numbers

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2F4GEqbPZRKMGzDuK1FkeF%2Fimage.png?alt=media&#x26;token=6046859c-6611-40cd-a86b-4e6392b1c96e" alt=""><figcaption></figcaption></figure>

### Task

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FMKuJFucR8wM0wRKZIgDp%2Fimage.png?alt=media&#x26;token=8b8bb8e4-4d19-4806-8967-f8fd17d08235" alt=""><figcaption></figcaption></figure>

### Solution

{% code lineNumbers="true" %}
```python
from cmath import phase

complex_number = complex(input())

print(abs(complex_number))
print(phase(complex_number))
```
{% endcode %}

***

## Power - Mod Power

### Introduction

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FOpDJBMe8AEFLfBv934E5%2Fimage.png?alt=media&#x26;token=87d93cad-5576-4d60-8df7-764414ed1193" alt=""><figcaption></figcaption></figure>

### Task

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2Ftwn1EjTK3ocsppvR3vv8%2Fimage.png?alt=media&#x26;token=e23c6ff7-7c51-4f28-adfb-e92acc066441" alt=""><figcaption></figcaption></figure>

### Solution

{% code lineNumbers="true" %}
```python
a = int(input())
b = int(input())
m = int(input())

print(pow(a, b))
print(pow(a, b, m))
```
{% endcode %}

***

## Integer Come in All Sizes

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FJ3DbRWW8plzc1OBywIuc%2Fimage.png?alt=media&#x26;token=38ac1ca4-5894-4e60-85ea-646a3b9a4cec" alt=""><figcaption></figcaption></figure>

<pre class="language-python"><code class="lang-python"><strong>a = int(input())
</strong>b = int(input())
c = int(input())
d = int(input())

print(pow(a, b) + pow(c, d))
</code></pre>

***

## Find Angle MBC

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FMhgAIiZkIIVplx1mS6Zt%2Fimage.png?alt=media&#x26;token=a8584346-a7ad-4471-b284-1f0872286b68" alt=""><figcaption></figcaption></figure>

```python
from math import degrees, atan

AB = int(input())
BC = int(input())

print(str(round(degrees(atan(AB / BC)))) + chr(176))
```

***

## Triangle Quest

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2Fr1sQ6jGaFxoDkscpLGcE%2Fimage.png?alt=media&#x26;token=70f310b6-a0ce-431f-9453-592fe3a04cc0" alt=""><figcaption></figcaption></figure>

```python
for i in range(1,int(input())):
    print(((10**i-1)//9)*i)
```

***

## Triangle Quest 2

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2F2vjYEnYBwQXfsv0NT2N7%2Fimage.png?alt=media&#x26;token=b267085c-7868-40d7-adad-ac9f4cab73b1" alt=""><figcaption></figcaption></figure>

```python
for i in range(1, int(input())+1):
    print(((10 ** i)//9) ** 2)
```
