Programming with Python DateTimes

The hands-on lab is part of this learning path

Introduction to Python
course-steps 3 certification 1 lab-steps 3

Lab Steps

lock
Logging in to the Amazon Web Services Console
lock
Connecting to the Python Web IDE
lock
Exercise 1 - DateTime Fundamentals
lock
Exercise 2 - Find Oldest File
lock
Exercise 3 - Find Youngest President

Ready for the real environment experience?

DifficultyBeginner
Max Duration1h 30m
Students75
Ratings
5/5
star star star star star

Description

Lab Overview

The Python 3 datetime module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic are supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.

This Lab is designed to introduce you to coding with date and times in Python, using the datetime module. You will be required to complete each of the following Python coding exercises:

  • Exercise 1 - DateTime: Complete the code required to work with and manipulate date time variables
  • Exercise 2 - OldestFile: Complete the code required to query the local filesystem to discover the oldest residing file
  • Exercise 3 - YoungestPresident: Complete the code required to read presidential data stored in a local text file and then sort it based on age

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 a Python script that creates datetime variables and manipulates date and times
  • Write a Python script that queries the current state of the local filesystem
  • Understand how to read in and parse datetime information stored within a local text file
  • Understand how to perform SQL inserts involving datetime information into a locally hosted SQLite database
  • 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 Python IDE served from the ide.python.platform.instance
  • Completing the following lab exercises:
    • Exercise 1 - DateTime
    • Exercise 2 - OldestFile
    • Exercise 3 - YoungestPresident
    • Exercise 4 - SQLite3

Updates

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

About the Author

Students12024
Labs28
Courses65
Learning paths14

Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.

He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.

Jeremy holds professional certifications for both the AWS and GCP cloud platforms.
 

Covered Topics