01/11/2025

Week 3 Learning Summary

Week 3 subject 1: Strings (cont.)

  • Modify string literals with embedded values and f-strings.
    • Adding and multiplying strings: note the difference between concatenating strings and printing multiple strings.
  • Methods to format strings

    • .title()
    • .upper(), lower()
    • .lstrip(), rstrip(), strip()
    • .removeprefix()

  • f-strings
    • Use variables in f-strings
    • way to format values of variables into strings
Week 3 subject 2: Numbers
  • Integer operations
    • +, -, *, /
    • **
    • %, //, pay special attention: how // works for negative numbers!
  • Floating point numbers are numbers with decimal points
  • Floating point operations
    • Same as integers
    • % and // also works for floats!
  • Type conversion from int to float
    • Automatic and manual conversion with float()
  • Never compare if floats are equal!

No comments: