hands-on lab

Programming with Python Introduction

Difficulty: Beginner
Duration: Up to 1 hour and 30 minutes
Students: 3,259
Rating: 4.5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Lab Overview

Python 3 is a highly productive scripting language that can be used in almost all use cases. You'll be shown the different approaches to invoking and executing Python scripts. You will be required to complete each of the following Python coding exercises:

  • Exercise 1 - HelloWorld: Complete the code required to work with and manipulate string variables, printing out messages to the console. Additionally, you will be shown the different methods available to launching your python code
  • Exercise 2 - LaunchExternalProgram: Complete the code required to launch the local netstat command using the operating system services within the os Python module, printing out local network connection stats
  • Exercise 3 - Traversal: Complete the code required to perform a folder and file traversal using the operating system services within the os Python module, printing out the size of each file discovered

Note: Each exercise has a provided solution to consult with when needed.

Lab Objectives

Upon completion of this lab, you will be able to:

  • Write Python script that creates string variables and manipulates strings
  • Write Python script that prints out to the console
  • Understand the different approaches to launching a Python script
  • Use the terminal to launch and debug Python scripts

You should:

  • Be comfortable with using a browser-based IDE

Lab Environment

This lab will start with the following AWS resources provisioned automatically for you:

  • A single EC2 instance, named ide.python.platform.instance, which will have a public IP address attached. This instance will host a web-based Python IDE (based on the Visual Code editor).

To achieve the lab end state, you will be walked through the process of:

  • Using your local browser, access the web-based Java IDE served from the ide.python.platform.instance
  • Completing the following lab exercises:
    • Exercise 1 - HelloWorld
    • Exercise 2 - LaunchExternalProgram
    • Exercise 3 - Traversal

Updates

December 10, 2021 - Updated the name of a file to match screenshots

May 12th, 2020  - Updated the lab instructions to allow for proper interaction with the lab files.

June 16th, 2018 - Optimized creation of lab resources to reduce the time it takes to access the browser IDE by 60%.

Covered topics

Lab steps

Connecting to the Python IDE
Exercise 1 - Hello World
Exercise 2 - Launch External Command
Exercise 3 - Directory Traversal