# Introduction

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

## Say "Hello, World!" With Python

```python
print("Hello, World!")
```

***

## Python If-Else

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FxRL4AaqAhbsJEdDYcpX6%2Fimage.png?alt=media&#x26;token=bbef61d5-c461-4c94-a072-14ee33e50c77" alt=""><figcaption></figcaption></figure>

<pre class="language-python" data-line-numbers><code class="lang-python"><strong>if __name__ == "__main__":
</strong>    n = int(input().strip())
    if n % 2 != 0 or n % 2 == 0 and 6 &#x3C;= n &#x3C;= 20:
        print("Weird")
    elif n % 2 == 0 and 2 &#x3C;= n &#x3C;= 5 or n % 2 == 0 and n > 20:
        print("Not Weird")
</code></pre>

***

## Arithmetic Operators

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FeSDHKJp9k4D6jxuEnM5S%2Fimage.png?alt=media&#x26;token=89227681-3dd0-46e9-93b7-833b96b4e3ba" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}
```python
if __name__ == '__main__':
    a = int(input())
    b = int(input())

    print(a + b)
    print(a - b)
    print(a * b)
```
{% endcode %}

***

## Python: Division

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FwKbs11ppPdUbUUo3yFTm%2Fimage.png?alt=media&#x26;token=79f61e68-8f82-402f-911e-466dc239ff29" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}
```python
if __name__ == '__main__':
    a = int(input())
    b = int(input())

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

***

## Loops

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2F3MrEz1Qu38WNgLICZPa5%2Fimage.png?alt=media&#x26;token=983f538d-28eb-4d2a-acb7-8d1b6517fc5c" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}
```python
if __name__ == '__main__':
    n = int(input())
    lst = list(range(0 , n))
    for each in lst:
        print(each * each)
```
{% endcode %}

***

## Write a Function

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FVsCxfmZOyX994S8jXeB8%2Fimage.png?alt=media&#x26;token=765eff2b-b13c-4751-ad51-2384bc9776d5" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}
```python
def is_leap(year):
    if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
        return True
    else:
        return False


if __name__ == "__main__":
    year = 1992
    print(is_leap(year))
```
{% endcode %}

***

## Print Function

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FW9KObb5N8FYLK4rqIsjk%2Fimage.png?alt=media&#x26;token=665c88fd-3f44-4086-86a9-38227f1e21fd" alt=""><figcaption></figcaption></figure>

{% code lineNumbers="true" %}
```python
if __name__ == '__main__':
    n = int(input())
    for i in range(1, n + 1):
        print(i, end="")
```
{% endcode %}
