Week 2: Numbers, Strings, Loops

Week 2 Goals

  • Understand and apply Python math operators on numeric types to compute arithmetic expressions.

  • Understand how to use the math library in a Python program, and learn to use some of its functions and definitions.

  • Understand and apply Python string operators to manipulate strings.

  • Understand how to use for loops to repeat actions.

  • Understand and appply the accumulator pattern.

Week 2 Code

  • circle.py: practice with numeric types and the math library.

  • str_practice.py: practice with strings and string operators.

  • loopExamples.py: loop examples.

  • loop.py: practice with for loops.

  • loop_strs.py: practice with for loops and strings.

  • avg.py, factorial.py : practice with numbers and accumulator pattern.

  • str_accum.py: practice with strings and accumulator pattern.