Coding · Grade 9
Expressions, Variables and Input
Using a bike-share fare calculator, learners evaluate Python expressions with precedence and associativity (including floor division of negatives and right-to-left powers), use augmented and simultaneous assignment, read and convert input, and format output with f-string specifiers. They discover why floating-point arithmetic is approximate and learn practical rules: compare with a tolerance and keep money in integer cents.
- 4 lessons
- About 85 minutes
- Check what you learned: 8 questions
- Ways to answer: fill in the blanks, choose an answer, put code in order, trace code, type a number and true or false
What learners will discover
- Evaluate arithmetic expressions using precedence and associativity, including **, //, % and negative operands.
- Trace augmented, multiple and simultaneous assignment, including swaps.
- Read and convert input and format output with f-string specifiers such as .2f and thousands separators.
- Explain floating-point imprecision and choose safe practices: tolerances for comparisons and integers for exact amounts.
Lessons
-
Expressions and precedence 6 steps3 practiceabout 20 min
-
Variables and assignment 4 steps2 practiceabout 18 min
-
Input and formatted output 6 steps4 practiceabout 22 min
-
Floating-point surprises 5 steps3 practiceabout 20 min
-
Check what you learned 8 questions at the end
Keep exploring
More 9th grade coding
- 9th Grade Coding Worksheets10 printable worksheets
Guide for grown-ups
- How to start homeschooling: a step-by-step guide for familiesA guide for parents · 7 min read