#day13 - Basics of Python for Devops Engineer to build the logic and Programs.
What is Python?
Python is a high-level, interpreted programming language that was first released in 1991. It was created by Guido van Rossum, and is named after the British comedy group Monty Python.
Python is known for its readability and ease of use, and is often used for scripting, automation, data analysis, web development, and scientific computing. It is an object-oriented language that supports multiple programming paradigms, including procedural, functional, and imperative programming.
Python has a large and active community of developers, and there are many third-party libraries and frameworks available that make it easy to build complex applications. Some popular Python libraries and frameworks include NumPy, Pandas, Flask, Django, and TensorFlow.
How to Install Python on AWS EC2 machine?
To install Python on an AWS EC2 machine, follow these steps:
Log in to your AWS Management Console and navigate to the EC2 Dashboard.
Launch a new EC2 instance and select the desired Amazon Machine Image (AMI) that supports Python.
Connect to your EC2 instance via SSH using your preferred client (e.g., PuTTY, Terminal, etc.).
Update the package repository on your EC2 instance by running the following command:
Install Python on your EC2 instance by running the following command:
- Check the Python version:
About different Data Types in Python:
In Python, there are several data types that we can use to store different kinds of values. Here are some of the most commonly used data types in Python:
Numbers: This data type is used to store numeric values such as integers, floating-point numbers, and complex numbers. For example,
5
,3.14
, and2+3j
are all numbers in Python.Strings: This data type is used to store text data. Strings are enclosed in either single or double quotes. For example,
"Hello, world!"
and'Python is awesome'
are both strings.Booleans: This data type is used to represent logical values. There are only two possible values for a Boolean:
True
andFalse
.Lists: This data type is used to store collections of values. Lists are ordered and mutable, which means that you can add, remove, and modify elements. For example,
[1, 2, 3]
and['apple', 'banana', 'cherry']
are both lists.Tuples: This data type is similar to lists, but tuples are immutable, which means that you cannot modify their contents once they have been created. Tuples are often used to group related data together. For example,
(1, 2, 3)
and('John', 25, 'Male')
are both tuples.Sets: This data type is used to store collections of unique values. Sets are unordered and mutable, which means that you can add, remove, and modify elements. For example,
{1, 2, 3}
and{'apple', 'banana', 'cherry'}
are both sets.Dictionaries: This data type is used to store key-value pairs. Dictionaries are unordered and mutable, which means that you can add, remove, and modify elements. For example,
{'name': 'John', 'age': 25, 'gender': 'Male'}
is a dictionary.
These are some of the most commonly used data types in Python. Understanding the different data types is important because it allows us to choose the right data structure for our needs and to perform operations on our data efficiently and effectively.
Thanks for Reading !
Keep Learning....