Intro to Conditional Statements in Python


Welcome to Week 8!

Welcome to Week 8 of the Earth Analytics Bootcamp course! This week, you will write efficient Python code using Jupyter Notebooks. You will will implement another strategy for DRY (i.e. Do Not Repeat Yourself) code: conditional statements combined with for loops.

Learning Objectives

After completing the lessons for Week 8, you will be able to:

  • Explain how conditional statements help you to write DRY code
  • Write Python code for conditional statements to run tasks only when certain conditions are met
  • Create for loops to automate tasks

Homework & Readings

Click here to view the GitHub Repo with the assignment template.

Earth Data Science Textbook Readings

Please read the following chapters of the Intro to Earth Data Science online textbook to support completing this week’s assignment:

Please read the following chapters to support completing this week’s assignment:

OPTIONAL: you may also want to read the chapter below on manipulating file paths and directories:

Example Homework Plots

The plots below are examples of what your plot could look like. Feel free to customize or modify plot settings as you see fit!

✅ The path /root/earth-analytics/data exists. Nothing to do here
Downloading from https://ndownloader.figshare.com/files/25033508
Extracted output to /root/earth-analytics/data/earthpy-downloads/ca-fires-yearly
Two bar plots. The top plot shows the monthly mean number of fires in California between 1992 and 2015. The bottom plot shows the monthly mean size of fires in California between 1992 and 2015.
Two bar plots. The top plot shows the monthly mean number of fires in California between 1992 and 2015. The bottom plot shows the monthly mean size of fires in California between 1992 and 2015.
Two scatter plots. The top plot shows fires in California from 2010-2015 by size and cause. The bottom plot shows fires in California from 1995-2000 by size and cause.
Two scatter plots. The top plot shows fires in California from 2010-2015 by size and cause. The bottom plot shows fires in California from 1995-2000 by size and cause.