Write Efficient, Clean Code in Python


Section Seven - Write Efficient and Clean Code in Python

In section seven of this textbook, you will learn about best practices and resources for writing clean, expressive code, including the PEP 8 Style Guide for Python, which provides useful standards for naming conventions and organization of code to support code readibility. You will also learn how to implement DRY (i.e. Do Not Repeat Yourself) code in Python using conditional statements to control the flow of your code as well as loops and custom functions to automate tasks.

Learning Objectives

After completing this section of the introduction to earth data science online textbook, you will be able to:

  • Explain best practices for writing clean, expressive code.
  • List key components of the PEP 8 Style Guide and explain how to apply these standards to your Python code.
  • Explain how conditional statements, loops, and functions help you to write DRY code in Python.
  • Write conditional statements, loops, and functions in Python to control the flow of code and automate tasks.
Section 7. Write Efficient, Clean Code in Python
Chapter 16 : Write Clean Expressive Code
Chapter 17 : Conditional Statements in Python
Chapter 18 : Loops in Python
Chapter 19 : Intro to Functions in Python

Updated: