Day 13 of #90DaysOfDevops

Day 13 of #90DaysOfDevops

·

4 min read

Python Basics

Python is a high-level programming language that is widely used for various purposes, including web development, data analysis, artificial intelligence, scientific computing, and more. It was created in the late 1980s by Guido van Rossum, and its design philosophy emphasizes code readability and simplicity.

Python is known for its concise syntax and ease of use, making it a popular language among beginners and experts alike. It supports various programming paradigms, including procedural, object-oriented, and functional programming.

Python has a vast standard library that provides many useful modules and functions for various tasks, such as web scraping, data processing, networking, and more. Additionally, Python has a vast ecosystem of third-party packages, including NumPy, Pandas, Scikit-learn, TensorFlow, and PyTorch, which make it a popular choice for data science and machine learning.

Python can be used on various platforms, including Windows, macOS, and Linux, and it has a vast community of developers who contribute to its development and provide support through various forums and communities.

Installation

To install Python on a Linux system, you can follow these general steps:

  1. Open a terminal window on your Linux system.

  2. Check if Python is already installed on your system by running the command:

     python --version
    

    If Python is already installed, you will see the version number printed to the console. If not, you can proceed with the installation.

  3. Update the package list of your system by running the command:

     sudo apt-get update
    
  4. Install Python by running the command:

     sudo apt-get install python
    

    This command will install the latest version of Python available in your Linux distribution's repository.

  5. Verify that Python has been installed correctly by running the command:

     python --version
    

    You should see the version number of Python printed to the console.

Different Data Types in Python

Python has several built-in data types that can be used to store and manipulate different kinds of data. Some of the most commonly used data types in Python are:

  1. Integers: Integers are used to represent whole numbers. They can be positive, negative, or zero. For example: 5, -10, 0.

  2. Floating-point numbers: Floating-point numbers are used to represent decimal numbers. For example: 3.14, 2.5e-3.

  3. Strings: Strings are used to represent a sequence of characters. They can be enclosed in single quotes ('...') or double quotes ("..."). For example: 'hello', "world".

  4. Booleans: Booleans are used to represent truth values. They can be either True or False.

  5. Lists: Lists are used to represent a collection of ordered and mutable items. They can contain any combination of data types. For example: [1, 'apple', True].

  6. Tuples: Tuples are used to represent an immutable collection of ordered items. They can contain any combination of data types. For example: (1, 'apple', True).

  7. Dictionaries: Dictionaries are used to represent a collection of key-value pairs. They are unordered and mutable. For example: {'name': 'John', 'age': 30}.

  8. Sets: Sets are used to represent a collection of unique and unordered items. They can contain any combination of data types. For example: {1, 'apple', True}.

In addition to these built-in data types, Python also supports user-defined data types, such as classes and objects, which allow for more complex data structures and custom behavior.


Complete roadmap to learn Python:

  • Learn Basics

    • Basic Syntax

    • Variable and Data types

    • Conditionals

    • Type Casting, Exceptions

    • Functions, Builtin Functions

    • Lists, Tuple, Sets, Dictionaries

  • Data Structures and Algorithms

    • Array and Linked lists

    • Heaps, Stacks and Queues

    • Hash Tables

    • Binary search trees

    • Recursion

    • Sorting Algorithm

  • Advanced Topics

    • Iterators

    • RegEx

    • Decorators

    • Lambdas

    • OOP

      • Classes

      • Inheritance

      • Methods, Dunder

    • Modules

      • Builtin

      • Custom

    • Package Managers

      • PyPI

      • pip

      • Conda

    • List comprehensions

    • Generator Expressions

    • Paradigms

  • Learn Framework

    • Synchronous

      • Django

      • Flask

      • Pyramid

    • Asynchronous

      • gevent

      • aiohttp

      • Tornado

      • Sanic

  • Testing your apps

    • doctest

    • nose

    • pytest

    • unitest/ pyUnit


Reach me on:

  1. Github-> https://github.com/Hrmn97

  2. Twitter -> https://twitter.com/Harman9765

  3. LinkedIn -> https://www.linkedin.com/in/chetan-harman-56310424a

  4. Website -> https://devhrmn.netlify.app/