Practice Lab: Introduction to Python

ラボ 14分 universal_currency_alt 無料 show_chart 入門
info このラボでは、学習をサポートする AI ツールが組み込まれている場合があります。
このコンテンツはまだモバイル デバイス向けに最適化されていません。
快適にご利用いただくには、メールで送信されたリンクを使用して、デスクトップ パソコンでアクセスしてください。

Introduction

Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured, object-oriented and functional programming.

You will learn about the Python print() function in this lab. The print() function prints the specified message to the screen, or other standard output device. The message can be a string, or any other object, the object will be converted into a string before written to the screen.

Disclaimer: For optimal performance and compatibility, it is recommended to use either Google Chrome or Mozilla Firefox browsers while accessing the labs.

Setup and requirements

Before you click the Start Lab button

Please go through these directions. The Labs have a time limit and cannot be paused. The timer begins when you click the Start Lab button, shows how long Google Cloud resources will be made available to you.

Green "Start Lab" button

After you click the Start Lab button, you will see an editor and terminal, where you will be performing further steps in the lab. It should looks like this:

Screenshot of ide."

Overview

You are going to finish a series of tasks related to Python programming.

Access pre-created files

  • Click the files icon as shown below to access the pre-created files.

Files

  • Each pre-created file has the prefix task as shown below. You will need to use these files to complete the tasks in the lab.

Assessment Files

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Knowledge about Python Programming
  • Time to complete the lab.

Task 1

You need to use Python programming to produce the text as an output.

  1. Click the files icon to access the pre-created file.

  2. Open the pre-created task1.py file, by clicking on the file name.

  3. Write the Python command to put My first Python program on the terminal screen.

Note: The three dots (...) indicate where to add the code.

. . . ("My first Python program")
  1. Execute the file by entering the following command in the terminal.
python task1.py

Task 2

Convert the following Bash command into its equivalent Python code.

echo Have a nice day
  1. Click the files icon to access the pre-created file.

  2. Open the pre-created task2.py file, by clicking on the file name.

  3. Write the Python code to put the output on the terminal screen.

  4. Execute the file by entering the following command in the terminal.

python task2.py

Task 3

You need to use Python programming to produce the text as an output into the multiple times.

  1. Click the files icon to access the pre-created file.

  2. Open the pre-created task3.py file, by clicking on the file name.

  3. Write the Python code to put This is fun! on the terminal screen 5 times.

Note: The three dots (...) indicate where to add the code.

for i in range(5): . . . ("This is fun!")
  1. Execute the file by entering the following command in the terminal.
python task3.py

Congratulations!

You have successfully completed the tasks related to Python Programming.

始める前に

  1. ラボでは、Google Cloud プロジェクトとリソースを一定の時間利用します
  2. ラボには時間制限があり、一時停止機能はありません。ラボを終了した場合は、最初からやり直す必要があります。
  3. 画面左上の [ラボを開始] をクリックして開始します

シークレット ブラウジングを使用する

  1. ラボで使用するユーザー名パスワードをコピーします
  2. プライベート モードで [コンソールを開く] をクリックします

コンソールにログインする

    ラボの認証情報を使用して
  1. ログインします。他の認証情報を使用すると、エラーが発生したり、料金が発生したりする可能性があります。
  2. 利用規約に同意し、再設定用のリソースページをスキップします
  3. ラボを終了する場合や最初からやり直す場合を除き、[ラボを終了] はクリックしないでください。クリックすると、作業内容がクリアされ、プロジェクトが削除されます

このコンテンツは現在ご利用いただけません

利用可能になりましたら、メールでお知らせいたします

ありがとうございます。

利用可能になりましたら、メールでご連絡いたします

1 回に 1 つのラボ

既存のラボをすべて終了して、このラボを開始することを確認してください

シークレット ブラウジングを使用してラボを実行する

このラボの実行には、シークレット モードまたはシークレット ブラウジング ウィンドウを使用してください。これにより、個人アカウントと受講者アカウントの競合を防ぎ、個人アカウントに追加料金が発生することを防ぎます。