Skip to main content

Command Palette

Search for a command to run...

Getting Started with Python

Published
•2 min read•View as Markdown
Getting Started with Python

Python, what is it?

  1. Python is a dynamically typed, general-purpose programming language that supports an object-oriented programming approach as well as a functional programming approach.

  2. Python consists of vast libraries and various frameworks like Django, Tensorflow, Flask, Pandas, Keras, etc.

  3. Python is an interpreted and high-level programming language but quite simple.

Installation of python

For linux

To install Python on Linux, We need to run the below commands

sudo apt-get update

sudo apt-get install python3

After installation to check the Python version need run the below command

Python3 --version

Data Types in Python:

Python supports the following data types:

  1. 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).

  2. Boolean type:

    bool: represents either True or False.

  3. 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)

  4. Set types:

    Set represents an unordered collection of unique elements. (e.g: myset = {"apple", "banana", "cherry"}

  5. 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))

  6. Mapping type:

    dict: represents a collection of key-value pairs. (e.g: a = {1:"first name", 2: "last name", "age":33})

More from this blog

DevOps

19 posts