Water Quality and Summary Statistics

This module is designed to be used in conjunction with the Lesson 1 slide deck and other resources located in the facilitator’s guide.

Lesson Objective: In this lesson, you will learn how to use the Python programming language to calculate summary statistics and investigate nitrates and nitrates in water samples.

Materials Needed:
- Your computer
- A web browser (Chrome, Firefox, or Safari)
- A calculator

🐍 Python is a programming language — a way to give instructions to a computer.

💻 Let’s Try Python!

Text/Strings

Python will print text. Click the ▶️ button below to run your first Python code:

🎯 Checkpoint 1. a: Print Statements!

Click the ▶️ Run Code button to run the block.

🎉 You just ran Python code! See how it printed “Hello, Water Scientist!” below the block? We call text like this a string.

Notice that strings must be in quotation marks within the code but those marks don’t appear when printed. The quotation marks just tell the computer “Hey! I’m writing regular text. Treat it like written English instead of code.,” and it does!


Math

Now let’s use Python to do some math!

🎯 Checkpoint 1. b: Mathematical Operators!

Click the ▶️ Run Code button to run the blocks.

Addition:

Subtraction:

✖️ Multiplication:

Division:




We can also ask Python to compare values:

🎯 Checkpoint 1. c: Comparing Values!

Click the ▶️ Run Code button to run the blocks.

This code states “The sum of 2 and 3 is greater than or equal to the product of 2 and 3.”

This code states “The sum of 2 and 3 is less than or equal to the product of 2 and 3.”



Text/Strings & Math

You can even combine the strings and math!

🎯 Checkpoint 1. d: Print Statements with Math!

Click the ▶️ Run Code button to run the block.



🧑‍💻 Try It Yourself!

Now YOU try! Edit the code below. Yes! You can type in the code block. Change the numbers, change the message, then click ▶️:

🎯 Checkpoint 1. e: Your own print statements with math!

Make the following modifications to the block below:

  • Change “Student” to your first name.
  • Create a new line 9 to calculate 15 times 4. Use lines 5 and 6 as models.
  • Try other math problems.

Click the ▶️ Run Code button to run the block.