response = input("Enter an integer : ")
num = int(response)
if num % 2 == 0:
    print("{} is an even number".format(num))

"""
Explanation: Control Structures
Control Structures construct a fundamental part of language along with syntax,semantics and core libraries. It is the Control Structures which makes the program more lively. Since they contol the flow of execution of program, they are named Control Structures
if statement
Usage:
python
    if condition:
        statement_1
        statement_2
        ...
        statement_n
<div class="alert alert-info">
**Note** 


In `Python`, block of code means, the lines with same indentation( i.e., same number of tabs or spaces before it). Here `statement_1` upto `statement_n` are in `if` block. This enhances the code readability
</div>
Example:
End of explanation
"""


response = input("Enter an integer : ")
num = int(response)
if num % 2 == 0:
    print("{} is an even number".format(num))
else:
    print("{} is an odd number".format(num))

"""
Explanation: <div class="alert alert-info">

**Note** Typecasting



`int(response)` converted the string `response` to integer. If user enters anything other than integer,  `ValueError` is raised

</div>

if-else statement
Usage:
python
    if condition:
        statement_1
        statement_2
        ...
        statement_n
    else:
        statement_1
        statement_2
        ...
        statement_n
Example:
End of explanation
"""


response = input("Enter an integer : ")
num = int(response)
result = "even" if num % 2 == 0 else "odd"
print("{} is {} number".format(num,result))

"""
Explanation: Single Line if-else
This serves as a replacement for ternery operator avaliable in C
Usage:
C ternery
c
    result = (condition) ? value_true : value_false
Python Single Line if else 
python
    result = value_true if condition else value_false    
Example:
End of explanation
"""


response = input("Enter an integer (+ve or -ve) : ")
num = int(response)
if num > 0:
    print("{} is +ve".format(num))
elif num == 0:
    print("Zero")
else:
    print("{} is -ve".format(num))

"""
Explanation: if-else ladder
Usage:
python  
    if condition_1:
        statements_1
    elif condition_2:
        statements_2
    elif condition_3:
        statements_3
    ...
    ...
    ...
    elif condition_n:
        statements_n
    else:
        statements_last
<div class="alert alert-info">
**Note** 


`Python` uses `elif` instead of `else if` like in `C`,`Java` or `C#`
</div>
Example:
End of explanation
"""


response = input("Enter an integer : ")
num = int(response)
prev,current = 0,1
i = 0
while i < num:
    prev,current = current,prev + current
    print('Fib[{}] = {}'.format(i,current),end=',')
    i += 1

"""
Explanation: <div class="alert alert-info">
**Note**: No `switch-case`


There is no `switch-case` structure in Python. It can be realized using `if-else ladder` or any other ways
</div>

while loop
Usage:
python
    while condition:
        statement_1
        statement_2
        ...
        statement_n
Example:
End of explanation
"""


for i in range(10):
    print(i, end=',')

for i in range(2,10,3):
    print(i, end=',')

response = input("Enter an integer : ")
num = int(response)
prev,current = 0,1
for i in range(num):
    prev,current = current,prev + current
    print('Fib[{}] = {}'.format(i,current),end=',')

"""
Explanation: <div class="alert alert-info">
**Note**


- Multiple assignments in single statement can be done
-`Python` doesn't support  `++` and `--` operators as in `C`
- There is no `do-while` loop in Python

</div>

for loop
Usage:
python
    for object in collection:
        do_something_with_object
<div class="alert alert-info">
**Notes**


- `C` like `for(init;test;modify)` is not supported in Python
- Python provides `range` object for iterating over numbers

Usage of `range` object:

```python
    x = range(start = 0,stop,step = 1)
```

now `x` can be iterated, and it generates numbers including `start` excluding `stop` differing in the steps of `step`
</div>

Example:
End of explanation
"""


