Practice Lab: Introduction to Python

Laboratório 14 minutos universal_currency_alt Sem custo financeiro show_chart Introdutório
info Este laboratório pode incorporar ferramentas de IA para ajudar no seu aprendizado.
Este conteúdo ainda não foi otimizado para dispositivos móveis.
Para aproveitar a melhor experiência, acesse nosso site em um computador desktop usando o link enviado a você por e-mail.

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.

Antes de começar

  1. Os laboratórios criam um projeto e recursos do Google Cloud por um período fixo
  2. Os laboratórios têm um limite de tempo e não têm o recurso de pausa. Se você encerrar o laboratório, vai precisar recomeçar do início.
  3. No canto superior esquerdo da tela, clique em Começar o laboratório

Usar a navegação anônima

  1. Copie o nome de usuário e a senha fornecidos para o laboratório
  2. Clique em Abrir console no modo anônimo

Fazer login no console

  1. Faça login usando suas credenciais do laboratório. Usar outras credenciais pode causar erros ou gerar cobranças.
  2. Aceite os termos e pule a página de recursos de recuperação
  3. Não clique em Terminar o laboratório a menos que você tenha concluído ou queira recomeçar, porque isso vai apagar seu trabalho e remover o projeto

Este conteúdo não está disponível no momento

Você vai receber uma notificação por e-mail quando ele estiver disponível

Ótimo!

Vamos entrar em contato por e-mail se ele ficar disponível

Um laboratório por vez

Confirme para encerrar todos os laboratórios atuais e iniciar este

Use a navegação anônima para executar o laboratório

Para executar este laboratório, use o modo de navegação anônima ou uma janela anônima do navegador. Isso evita conflitos entre sua conta pessoal e a conta de estudante, o que poderia causar cobranças extras na sua conta pessoal.