Introduction of Python

Google uses Python extensively in its web search systems and even employed Guido van Rossum, the inventor of Python.

Let’s start with what we will learn together.

We will discuss how to code in Python using Google Colab, a free online platform by Google designed for collaboration.

We will also do our first exercise together. Then, we will talk about who uses Python and the pros and cons of using this programming language.

Now, let’s talk about why we are using Google Colab

It’s simple: Google Colab is free to use on any device. You don’t need to install anything, which makes it convenient for everyone.

Next, let’s discuss how we will learn to code in Python here in Level 1. We will start with a basic exercise using Google Colab to print “Hello World.”

Although we will be using Google Colab to teach Python in this course, you can use any other Python platform you prefer while reading and doing the exercises.

In addition to the exercise, at the end of Level 1, we will have a short quiz to help reinforce what we have learned together.

There are many ways to code with Python for free.

You can download software for Windows, Mac, or Linux.

However, for this course, we will use Google Colab, a free online service from Google that works on desktops, laptops, and even mobile devices.

Google Colab is similar to Gmail in that it is cloud-based.

You can access Google Colab at this website: Google Colab.

The great thing about Google Colab is that everything you need to code is available right there. You don’t need to download anything, which means the code you create in Google Colab will work on any device.

For this Course, there is no need to pay for the Pro version of Google Colab. The free version provides all the tools we need.

To get started with Google Colab, you need a Gmail address, which is free and easy to set up.

Once you’re logged in, you can create new notebooks, which are stored on your Google Drive. Similar to Google Docs or Google Sheets, you can share your notebooks by clicking the share button.

Codlab 1

To code, simply type your code next to the play button and click the play button to run it. 

colab2

You can also add text to explain your code by clicking “+text.” However, we prefer to add comments directly to the code using the hash sign (#). 

Comments are in green and are not read by Python when you run the code. 

It’s important to add comments to your code so that others can understand it, or so you can understand it yourself if you come back to it later.

Google Colab saves your work automatically in the cloud, so you don’t need to worry about losing your progress.

You can also name your code by clicking on the file name in the top left corner. The extension “ipynb” stands for “Interactive Python Notebook.”

You can save a copy of your notebook or export it to GitHub, where people share code. Google Colab also has autocomplete to help you while coding.

There are several pros to using Google Colab:

  • no installation issues,
  • free GPU usage,
  • easy sharing,
  • and it’s perfect for collaborative work.

However, there are some cons too, such as GPU limitations if you use it extensively, and it’s not secure enough for corporate use since it runs in the cloud.

Despite these limitations, Google Colab is an incredible free tool for learning how to code in Python.

Exercise 1.1: Our First Python Code: "Hello World"

Welcome to our first exercise. For this exercise, follow these three steps:

  1. Sign up for an account at Google Colab.
  2. Create a new notebook.
  3. Type these two lines of code and run them:
    • Create a comment that says: # This code prints Hello World
    • Print “Hello World” with: print("Hello World")

After completing these steps, we will explain the answer in the next chapter. If you get an error message, don’t worry, we’re just starting.

colab 3

Who Uses Python and What Are the Pros and Cons of Python?

Google uses Python extensively in its web search systems and even employed Guido van Rossum, the inventor of Python.

Today, Python is mostly associated with AI and data analysis. Many large companies like Goldman Sachs, JP Morgan, Microsoft, Spotify, and Pixar use Python for machine learning and data processing.

Python can be used for many things, which opens up numerous career opportunities. For example, YouTube and Netflix use Python for their platforms.

Python is also used in fields like algorithmic trading, risk management, financial modeling, autonomous vehicles, national security, and supply chain management.

The pros of using Python include its ease of learning, free availability, and a large number of libraries.

It has a huge user base, making it easy to find help and code samples online. Many companies are hiring Python programmers due to its widespread use in AI.

However, Python has some cons. It is slower than compiled languages like C++. In this book, we will teach you how to use tools like NumPy, Pandas, and Polars to make Python faster.

Compiled languages like C++ are pre-assembled and run quickly, while interpreted languages like Python are assembled on-the-fly.

This means you can see the results almost instantly, which makes Python fun to use. However, if you need to build a very fast application, like a video game, a compiled language might be a better choice.

Understanding the difference between compiled and interpreted languages is important because it helps you choose the right tool for the job. 

While Python is great for many applications, there are times when a compiled language might be more appropriate.

Play Video about finding Video

Other Lecture