Python, what is it?
Python is a dynamically typed, general-purpose programming language that supports an object-oriented programming approach as well as a functional programming approach.
Python consists of vast libraries and various frameworks like Django, Tensorflow, Flask, Pandas, Keras, etc.
Python is an interpreted and high-level programming language but quite simple.
Installation of python
You can install Python in your System whether it is window, MacOS, ubuntu, centos etc. Below are the links for the installation:
[Windows Installation] (https://www.python.org/downloads/)
Ubuntu:
sudo apt-get install python3.6
Centos:
yum install python
After installation to check the Python version need run the below command
Python3 --version
Data Types in Python:
Python supports the following data types:
Numeric types:
int: represents integer values (e.g.: 1, 2, 3).
float: represents floating-point numbers with decimal places (e.g.: 3.14, 2.0).
complex: represents complex numbers in the form a + bi (e.g: 2+3j).
Boolean type:
bool: represents either True or False.
Sequence types:
str: represents a sequence of characters.
(e.g: "Hello World!", "Test string")
list: represents an ordered collection of elements that can be changed (mutable). (e.g: a= [1,2,3,4,5,6])
tuple: represents an ordered collection of elements that cannot be changed (immutable).
(e.g: tuple = ("parrot", "sparrow"))
range: represents a sequence of numbers that can be iterated over.
(e.g: range(5) returns 0, 1, 2, 3, 4)
Set types:
The set represents an unordered collection of unique elements.
(e.g: myset = {"apple", "banana", "cherry"}
NoneType:
NoneType is a special data type in Python that represents the absence of a value. It is often used as a default value or a placeholder.
(e.g: x = None => print(x))
Mapping type:
dict: represents a collection of key-value pairs.
(e.g: a = {1:"first name", 2: "last name", "age":33})