Day 13 - Introduction to Python

Day 13 - Introduction to Python

ยท

3 min read

What is Python?

  • Python is a Open source, general purpose, high level, and object-oriented programming language.

  • It was created by Guido van Rossum

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

It is used for:

  • web development (server-side),

  • software development,

  • mathematics,

  • system scripting.

How to Install Python?

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

Task1:

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

  1. Read about different Data Types in Python.

Python is a dynamically-typed language, which means you don't need to explicitly declare the data type of a variable. Instead, Python determines the data type based on the value assigned to the variable. Here are the most commonly used data types in Python:

  1. Numeric Types:

    • int: Represents integers, e.g., 1, -10, 100, etc.

    • float: Represents floating-point numbers with decimal points, e.g., 3.14, -0.5, 2.0, etc.

    • complex: Represents complex numbers in the form a + bj, where a and b are floats or integers, and j is the imaginary unit, e.g., 2 + 3j.

  2. String (str):

    • Represents sequences of characters enclosed in single quotes (' '), double quotes (" "), or triple quotes (''' ''').
  3. Boolean (bool):

    • Represents Boolean values True or False (Note: The capitalization matters; True and False are reserved keywords).
  4. Sequence Types:

    • list: Represents an ordered collection of elements. Lists are mutable, which means their elements can be changed after creation. Lists are created using square brackets, e.g., [1, 2, 3].

    • tuple: Similar to lists but immutable. Once created, the elements cannot be modified. Tuples are created using parentheses, e.g., (10, 20, 30).

  5. Range Type:

    • range: Represents an immutable sequence of numbers commonly used for looping. It is created using the range() function.
  6. Mapping Type:

    • dict: Represents a dictionary, which is an unordered collection of key-value pairs enclosed in curly braces {}. Each key is unique, and its associated value can be accessed or modified using the key.
  7. Set Types:

    • set: Represents an unordered collection of unique elements. Sets do not allow duplicate values. Sets are created using curly braces, e.g., {1, 2, 3}.

    • frozenset: Similar to sets, but immutable like tuples. Frozensets are created using the frozenset() function.

  8. NoneType:

    • Represents a special data type with a single value, None. It is often used to indicate the absence of a value or as a default value for variables.

Python also allows you to create user-defined data types using classes, which is one of the fundamental aspects of object-oriented programming in Python.

If you find my blog valuable, I invite you to like, share, and join the discussion. Your feedback is immensely cherished as it fuels continuous improvement. Let's embark on this transformative DevOps adventure together! ๐Ÿš€ #devops #90daysofdevop #python

ย