Skip to main content

Command Palette

Search for a command to run...

Python For Devops

Published
3 min readView as Markdown
Python For Devops

DAY-13

# What is Python?

Python is an Open source, general-purpose, high-level, and object-oriented programming language. It was created by Guido van Rossum Python consists of vast libraries and various frameworks like Django, Tensorflow, Flask, Pandas, Keras etc. Python is a high-level programming language, meaning it abstracts complex low-level details and provides a more user-friendly interface. Developers can focus on solving problems and implementing logic without getting hardware-specific concerns

#PYTHON INSTALLATION ON LINUX AND VERSION--

sudo apt update

sudo apt install python3

"/python3 --version"

"/python --version"

TASK 2 - different Data Types in Python.

Int: Whole number can be a of any length, like numbers 80, 9, 89, - 20, - 150, and so on. eg - a = 8 print(type(a))
Float: Float stores drifting point numbers like 1.9, 9.902, 15.2, etc. It can be accurate to within 15 decimal places. eg - b = 10.5
print(type(b))
Complex: An intricate number contains an arranged pair, i.e., x + iy, where x and y signify the genuine and non-existent parts separately. The complex numbers like 2.14j. eg - c = 1+3j
print(type(c))
Dictionary A dictionary is a key-value pair set arranged in any order. It stores a specific value for each key, like an associative array or a hash table. Value is any Python object, while the key can hold any primitive data type.

bool: Represents boolean values, which can be either True or False. Used for logical operations and control flow. eg -print(type(True))

set: Represents an unordered collection of unique elements. Sets do not allow duplicate values, and they are defined using curly braces { }.

string: The sequence of characters in the quotation marks can be used to describe the string. A string can be defined in Python using single, double, or triple quotes. EG - str = "string using double quotes"
print(str)

DAY14--

Data Types:-

Represents the kind of value that tells what operations can be performed on a particular data. data types are classes and variables are instances (objects) of these classes.

Data Structures:-

Data Structures are a way of organizing data so that it can be accessed more efficiently depending on the situation. Data Structures are fundamentals of any programming language around which a program is built.

TASK-1 - Difference between List, Tuple and set.

**LIST -- Lists in Python are like arrays in C, but lists can contain data of different types.

**TUPLE -- contains a collection of items from various data types. A parenthetical space () separates the tuple's components from one another.

**SET -- Set is a collection of unique data. That is, elements of a set cannot be duplicates

TASK 2- Create below Dictionary and use Dictionary methods to print your favourite tool just by using the keys of the Dictionary.

TASK 3- Create a List of cloud service providers eg.

Write a program to add Digital Ocean to the list of cloud_providers and sort the list in alphabetical order.

DAY 15-

TASK-1 : Create a Dictionary in Python and write it to a json File.

TASK-2 : Read a json file services.json kept in this folder and print the service names of every cloud service provider

TASK -3: Read YAML file using python, file services.yaml and read the contents to convert yaml to json

LINKEDIN URL -- https://www.linkedin.com/in/muskan-bhutani/