Being-Creative-with-AI/C3/Getting-Started-with-Python-in-Google-Colab/English

From Script | Spoken-Tutorial
Jump to: navigation, search
Visual Cue Narration
Title Slide Welcome to this spoken tutorial on Getting Started with Python in Google Colab.
Learning Objectives Slide In this tutorial, we will learn to -
  • Use Google Colab
  • Run a Python code for the Hello World program
  • Create and use Variables and Strings
  • Format output using f-strings
  • Run the print function
Disclaimer Content Slide As Al tools constantly evolve, if you are unable to locate any icon or encounter difficulty at any step, you may use any conversational Al Chatbot for guidance.
System Requirement To record this tutorial, I am using:
  • A laptop with an internet connection.
  • A web browser such as Chrome, Firefox, or Edge.
  • An active Google account to access Google Colab.
Pre-requisite Slide To follow this tutorial, the learner should be familiar with basic computing.

No prior Python programming experience is required.

Pre-requisite

For the Pre-requisites of this tutorial, visit the website shown on your screen

http://EduPyramids.org

For the Pre-requisites of this tutorial, visit the website shown on your screen
Code Files

The following code file is required to practice this tutorial.

Python-in-Google-Colab.txt

This file is provided in the code files link of this tutorial page.


Please download and extract the file.

The following code file is required to practice this tutorial.

This file is provided in the Code Files link of this tutorial page.

Please download and extract the file.

Show slide: Why Python? Python is widely used for Artificial Intelligence.
Show slide: Easy to read. Global community. It is a simple and powerful programming language.

It is easy to read and learn.

Community A large global community builds many free tools for Python.
Show Google Colab homepage We will use Google Colab, a cloud-based editor in this tutorial.
Show browser address bar with colab.research.google.com Open any web browser and Log into your Google account.

Now in the address bar type and press enter.

Show Google Colab welcome page Welcome to Colab webpage opens with an Open notebook pop-up window.
Highlight “New Notebook” button To begin, we will create a new notebook.

For that, we will go to the bottom left of the pop-up window.

Then click on the tab plus New notebook.

Show Untitled0.ipynb

practice.ipynb

A new webpage opens.

A file name appears on the top left corner of the webpage.

By default it is named as this:

Let us rename this as shown on the screen.

This file is automatically saved to your Google drive.

Show blank Colab code cell Now we are ready to write Python code.
Code cell Notice the input bar here, it says Start coding or generate with AI.
Type print("Hello World") in cell In a new code cell type:

print then open parenthesis followed by double quotes. Hello World in between the double quotes.

Now, press Shift and Enter Keys together.

Notice the loading icon, it means the output is getting generated.

Here it is .

The output says Hello World.

Show Hello World output Congratulations. You have run your first Python program.
Show slide: Variables and Strings — step by step Now, we will learn about Variables and Strings step by step.
product_name = "Smart Coffee Mug" In a new cell, type product underscore name space equal to space double quotes open Smart Coffee Mug close double quotes
Press Shift and Enter Keys together. Now, press Shift and Enter Keys together.
product_name="Smart Coffee Mug" This saves the text inside a variable named product underscore name.
product_name To check the value, in a new cell type: product underscore name

Now, press Shift and Enter Keys together to view the value.

Show output ‘Smart Coffee Mug’ You can see the stored text, Smart Coffee Mug
type(product_name) Now, let's check the data type.

In a new cell, type this command: type parenthesis open product underscore name parenthesis close

Now, press Shift and Enter Keys together.

Show output <class 'str'> The output is s t r, which stands for string.

This is the format Python uses for text.

New code cell To open a new cell, press plus code button.

If you already have a new cell, you may ignore this step.

print("Product:", product_name) Now type the following print open parenthesis double quotes Product colon close quote comma product underscore name close parenthesis

Now, press Shift and Enter Keys together

Display of product and variable Here, Product is the text and product underscore name is the variable.

Notice how both are displayed on the same line.

greeting=f"Welcome to {product_name}" Now pause the video and type the command

'Greeting 'is equal to f double quote Welcome to open braces product underscore name close braces

Now press shift and enter keys together.

greeting = f"Welcome to {product_name}" This line uses an f-string.
Type greeting = f"Welcome to {product_name}" f tells Python to insert the variable value inside the string.
print(greeting) Type print now open parenthesis greeting close parenthesis and press Shift and Enter keys together.

Notice the output.

Welcome to Smart Coffee Mug This is how variables and strings work together.
Slide: Summary In this tutorial, we learnt to:

Set up and use Google Colab.

Execute the first Hello World program.

Practice using the print function.

Create and use variables and strings.

Slide: Assignment

1) Open Google Colab

2) Create your own product_name variable

3) Print a greeting using that variable

Now, here is an assignment for you.
Acknowledgement This brings us to the end of this tutorial.
Closing slide

This Spoken Tutorial is brought to you by EduPyramids Educational Services Private Limited, SINE, IIT Bombay.


Thank you for joining.


Contributors and Content Editors

Madhulika, Misbah