Skip to content

Python Basics – Numbers Utility

Overview

This utility helps beginners practice Python number handling. It pairs with the foundational lessons in Documentation/Programs/level1_fundamentals.py and extends the concepts with finance-flavored examples.

Concepts Covered

  • Integer vs. floating-point arithmetic
  • Using the decimal module for currency math
  • Common math functions (abs, round, pow)
  • Simple financial calculations (percentage change, compound interest)

Files

  • numbers_tutorial.py: Annotated walkthrough script with interactive printouts

How to Run

python numbers_tutorial.py
Open the file while it runs to connect each console message with the source code comments.

Practice Ideas

  • Create a helper that rounds portfolio values to the nearest cent
  • Build a function that converts annual returns to monthly returns
  • Generate a simple amortization schedule using loops and decimal arithmetic

Next Steps

  • Explore UTILS - Python Basics - Strings/ for text processing
  • Move into arrays with UTILS - Data Structures - Arrays/ when ready