Sep 11: Quiz1, def Statements
Learning Objectives
After today's class, you should be able to:
- Write a function that performs a unit conversion (Ex: celsius to fahrenheit).
Reminders¶
- Due today: HW3 Reflection
- Read Ch 4 – ideally:
- 1st half before Friday
- 2nd half before Monday
- Submit HW 4 – ideally:
- 1 and 2 before Friday
- 3 and 4 before Monday
HW3 Debrief¶
[10 min]
Some highlights:
- Use
else
whenever possible, instead of extraelif
- Boolean values as variables, for flags and conditions
- Avoid doing the same conditions / logic multiple times
Quiz 1¶
[25 min]
Instructions:
- Log in as
student
- Only two windows:
- Thonny
- Web browser
- Web traffic monitored
- Log out when finished
Ch04 Preview¶
[15 min]
- Functions have parenthesis
- Example from algebra: \(f(x) = 2x\)
- \(f\) is a function, \(x\) is a variable, \(2x\) is the result
- Python keywords:
def
andreturn
def double(number): return 2 * number
- Using descriptive names for functions/variables
- Added Docstring Requirements for Functions
temperature.py | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|