Day 13 : Introduction to Python

Day 13 : Introduction to Python

Why python??

Python is really popular because it's easy to learn and can be used for many different things like making websites, analyzing data, or teaching computers to think. It comes with lots of helpful tools and there are tons of other tools made by people all over the world. If you have a question or get stuck, there are lots of friendly folks online who can help you out. Plus, it's free for anyone to use, which is pretty cool! Overall, people like Python because it's easy, helpful, and you can do a lot of cool stuff with it

What is Python?

Python is a popular programming language created by Guido van Rossum. He started working on Python in the late 1980s, and the first version was released in 1991. Guido van Rossum wanted to create a language that was easy to read and write, aiming for simplicity and code readability. Over the years, Python has grown in popularity and is now widely used for various purposes, including web development, data analysis, artificial intelligence, and more. Guido van Rossum's vision and ongoing contributions have played a significant role in shaping Python into what it is today.

How to Install Python?

You can install Python in your System whether it is Windows, Mac OS, Ubuntu, centos etc. Below are the link for the installation:

Windows Installation please use the below URL for the latest python installation.

python.org/downloads

Task1:

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

Download Python: Go to the official Python website and download the latest version of Python for Windows.

  1. Run Installer: Once the download is complete, run the installer. Make sure to check the box that says "Add Python to PATH" during the installation process. This will make it easier to run Python from the command line.

  2. Install Python: Follow the prompts in the installer to complete the installation process.

  3. Verify Installation:Once the installation is complete, you can verify that Python was installed correctly by opening a command prompt. You can do this by searching for "cmd" in the Windows search bar and clicking on "Command Prompt".

    In the command prompt, type python --version and press Enter. You should see the version number of Python that you installed.

  4. (Optional) Install an IDE:

    While not strictly necessary, you may want to install an Integrated Development Environment (IDE) to make writing and running Python code easier. Some popular choices include PyCharm, Visual Studio Code, and IDLE (which comes bundled with Python).

Task2:

Read about different Data Types in Python.

Python supports several built-in data types that are used to represent different kinds of data. Here are some of the main data types in Python:

  1. Numeric Types:

    • int: Integers represent whole numbers, positive or negative, without any decimal point.

    • float: Floats represent real numbers and are written with a decimal point dividing the integer and fractional parts.

  2. Sequence Types:

    • list: Lists are ordered collections of items. They can contain elements of different data types and are mutable, meaning you can modify them after creation.

    • tuple: Tuples are similar to lists, but they are immutable, meaning they cannot be modified after creation.

    • range: Range is used to represent a sequence of numbers. It is often used for looping a specific number of times in for loops.

  3. Mapping Type:

    • dict: Dictionaries are unordered collections of key-value pairs. Each key is associated with a value, and they provide a way to store and retrieve data using keys.
  4. Set Types:

    • set: Sets are unordered collections of unique elements. They are useful for tasks that involve membership testing, removing duplicates, and mathematical operations like union, intersection, etc.

    • frozenset: Similar to sets, but they are immutable.

  5. Boolean Type:

    • bool: Boolean represents the truth values True and False. Booleans are typically used in control flow statements and comparisons.
  6. Text Sequence Type:

    • str: Strings are sequences of characters, enclosed within single quotes, double quotes, or triple quotes. They are immutable, meaning they cannot be changed after creation.
  7. Binary Types:

    • bytes: Bytes represent a sequence of bytes. They are immutable and usually used for handling binary data.

    • bytearray: Byte arrays are mutable counterparts of bytes.

  8. None Type:

    • None: None is a special constant in Python that represents the absence of a value or a null value.

These are the main built-in data types in Python. Understanding them and knowing when to use each one is essential for effective programming in Python.

Thank you for reading my blog. Don't forget to follow, comment and like my blog.

Did you find this article valuable?

Support Zehra Jabeen by becoming a sponsor. Any amount is appreciated!