Learn PYTHON for DevOps ♾️in 3 DAYs.
Tags: python, devops, scripting, automation
Published: 2022-09-11 09:10:00

## Prerequisite: PYTHON INSTALLATION WITH VIRTUAL ENVIRONMENTS
install the python latest version
so visit [python.org](https://www.python.org/downloads/)

**What is VS code?**
it's an editor where you can read and write code, simple :). it's good to download VS code and install it.

[**How to install it ?**](https://code.visualstudio.com/download )
open terminal in VScode and create folder for project
and create virtual environment 
```
pip install virtualenv
```
```
virtualenv -p python3.10 <name>
```
it will create the env folder in your directory or folder 
now active this environment
```
source env/bin/activate
```
```
python --version
```
```
deactivate
```
### Day-1 : YOUR FIRST CODE

Then you say that, ** i'm not a programer or coder?** it's mean you are unable to transfer your need file `<code>.py` to the OS compiler to compile and operate your task as you wish/need.

open the interactive terminal of python
```
python
```
**Variable and constance**
`V >> a=20
C >> 20
`
**data type in puthon**
`[int,float,str,bool]
int >> a=20
float >> a=20.01
str >> a="asad"
bool >> coding=true
`
```
type(a) && type(coding)
```
output:
```
<class 'int'> <class 'bool'>
```

**take input from user**
`
>> num=input("Enter your number")
`
**take input from user with type casting**
`
>> num=int(input("enter your number"))
`
![Steps](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehnl8pnjdiiewdarp2e5.png)

#### CODE BLOCK #1

let make a script of python using simple conditional statement.
*my_first_code*.py
`
env=input("enter your cloud: ")
if env == "aws" or env =="AWS":
    print("you are in AWS environment")
else:
    print("you are in an other cloud environment")
`
you can run this file from VScode terminal or OS terminal by just define the file name with python command.`remember : terminal open in the same working path` 
```
python *my_first_code*.py
```
or
```
python3.10 *my_first_code*.py
```
let make another calculater script of python using simple conditional statement.
*calculater_code*.py

`num1 = float(input("enter your first number")
num2 = float(input("enter your second number")
opr = input("enter your operator")
`
`if opr == "+":
    output=num1+num2
if opr == "-":
    output=num1-num2
if opr == "*":
    output=num1*num2
if opr == "/":
    output=num1/num2
if opr == "%":
    output=num1%num2
print("you calculation is equal to ",output)
`

`if num1 < 3:
    print("you are in an other cloud environment")
`

#### CODE BLOCK #2

let make another script of python using list Function.
*my_Second_code*.py
`
names = list([ "syed","johan","nihao","Ramesh"])
//// to get the full list of names.
print(names)
//// to get the list of names by calling them separately. 
print(names[0])
print(names[1])
print(names[2])
print(names[3])
`

#### READ BLOCK #1

let start reading the most basic and advance concept of Python by just **go-throw** the [linkedin Skill Quiz assessment](https://github.com/Ebazhanov/linkedin-skill-assessments-quizzes/blob/main/python/python-quiz.md).

the best thing of this link is an **Open-source** python repository, So the new changing are **Committed** and new _question_ is added by the multiple people which is almost an python expert.