Python for DevOps: #Day13 of 90DaysofDevops

What is Python?
Python is a computer programming language often used to build websites and software, automate tasks and conduct data analysis.

It is a general-purpose language, meaning it can be used to create a variety of different programs and isn’t…


This content originally appeared on DEV Community and was authored by On-cloud7

What is Python?
Python is a computer programming language often used to build websites and software, automate tasks and conduct data analysis.

It is a general-purpose language, meaning it can be used to create a variety of different programs and isn’t specialized for any specific problems.

How it is useful for DevOps?
Python is one of the best programming languages for Automation in DevOps.
DevOps teams use Python for automating repetitive tasks, infrastructure provisioning, and API-driven deployments. CI/CD workflows and much more.

Installation:
You can install Python in your System whether it is Windows, MacOS, ubuntu, centos etc. Below are the links for the installation:

Windows installation

Ubuntu: apt-get install python3.6

Task1:

  1. Install Python in your respective OS, and check the version.

I have installed it on Windows.

Image description

Read about different Data Types in Python.

Variables can store data of different types, and different types can do different things.

Python has the following data types built-in by default, in these categories:

  1. Numeric Types:int, float, complex,
  2. Sequence Types: list, tuple, range.
  3. Mapping Type:dict
  4. Set Types: set, frozenset
  5. Boolean Type:bool
  6. Binary Types:bytes, bytearray, memoryview.

1. Python Numeric Data Type:
Python numeric data type is used to hold numeric values like;

int -holds signed integers of non-limited length.

float- holds floating precision numbers and it’s accurate up to 15 decimal places.

complex- holds complex numbers.

2. Python String Data Type:

The string is a sequence of characters. Python supports Unicode characters. Generally, strings are represented by either single or double quotes.


a = "Hello everyone"
b= 'I am NamG'
print(a)
print(b)

Python List Data Type:
Lists are just like arrays, declared in other languages which is an ordered collection of data. It is very flexible as the items in a list do not need to be of the same type. Lists are mutable.

Lists in Python can be created by just placing the sequence inside the square brackets[ ].

list of having only integers:

a= [1,2,3,4,5,6]
print(a)

list of having only strings:

b=["hii","hello","good"]
print(b)

list of having both integers and strings

c= ["hello","name",1,2,3]
print(c)

4. Python Tuple:

The tuple is another data type which is a sequence of data similar to a list but it is immutable. That means data in a tuple is write-protected. Data in a tuple is written using parenthesis ( ) and commas.

#tuple having multiple type of data.

b=("hello", 1,2,3,"namg")
print(b)

5. Python Dictionary:

Python Dictionary is an unordered sequence of data of key-value pair form. It is similar to the hash table type. Dictionaries are written within curly braces in the form key: value. It is very useful to retrieve data in an optimized way among a large amount of data.

a = {"firstname":"sayali","last name":"shewale", "age":25}

print value having key=1

print(a[1])

print value having key=2

print(a[2])

print value having key=3

print(a[3])


This content originally appeared on DEV Community and was authored by On-cloud7


Print Share Comment Cite Upload Translate Updates
APA

On-cloud7 | Sciencx (2024-06-16T12:09:39+00:00) Python for DevOps: #Day13 of 90DaysofDevops. Retrieved from https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/

MLA
" » Python for DevOps: #Day13 of 90DaysofDevops." On-cloud7 | Sciencx - Sunday June 16, 2024, https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/
HARVARD
On-cloud7 | Sciencx Sunday June 16, 2024 » Python for DevOps: #Day13 of 90DaysofDevops., viewed ,<https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/>
VANCOUVER
On-cloud7 | Sciencx - » Python for DevOps: #Day13 of 90DaysofDevops. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/
CHICAGO
" » Python for DevOps: #Day13 of 90DaysofDevops." On-cloud7 | Sciencx - Accessed . https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/
IEEE
" » Python for DevOps: #Day13 of 90DaysofDevops." On-cloud7 | Sciencx [Online]. Available: https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/. [Accessed: ]
rf:citation
» Python for DevOps: #Day13 of 90DaysofDevops | On-cloud7 | Sciencx | https://www.scien.cx/2024/06/16/python-for-devops-day13-of-90daysofdevops/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.