Python Math Module: Functions, Constants and Rounding - Python with AI tutorial chapter 27
Python

Python Math Module: Functions, Constants and Rounding

The Python math module gives you the functions a calculator has and a spreadsheet takes for granted: square roots, logarithms, ceiling and floor, factorials, constants such as pi and e, and precise summation. Combined with the built-in round() and the decimal module for money, it covers almost every number you will meet in business scripts. […]

Python Variables: Naming Rules, Assignment and Types - Python with AI tutorial chapter 5
Python

Python Variables: Naming Rules, Assignment and Types

Python variables are named containers that hold a value, such as a price, a customer name or a list of invoices. You create a variable simply by assigning to it with =; there is no declaration step and no type keyword. This chapter covers how to name variables, how to assign them, how Python decides […]

Python Booleans: True, False and Truthy Values - Python with AI tutorial chapter 11
Python

Python Booleans: True, False and Truthy Values

Python booleans are the two values True and False. They are the answer to every yes-or-no question your program asks: is the invoice paid, is stock below the reorder level, does this list contain anything? Comparisons and conditions produce booleans, and Python also treats every other value as truthy or falsy, which this chapter explains. […]

Python with AI: Write Code with ChatGPT, Claude and Copilot - Python with AI tutorial chapter 42
Python

Python with AI: Write Code with ChatGPT, Claude and Copilot

Python with AI means writing, fixing and understanding Python code together with an AI assistant such as ChatGPT, Claude or GitHub Copilot. You describe the task in plain language, the assistant drafts the code, and you run, test and refine it. Used well, it removes the blank-page problem and teaches you idioms faster than searching […]

Python Dates: datetime, strftime and Date Arithmetic - Python with AI tutorial chapter 26
Python

Python Dates: datetime, strftime and Date Arithmetic

Python dates live in the built-in datetime module. It gives you date for a calendar day, datetime for a day plus time, timedelta for a duration, and strftime / strptime to convert between dates and text. Master those four and every due date, ageing report and month-end calculation becomes a few lines. Dates look simple […]

Python Comments: Single-Line, Multi-Line and Docstrings - Python with AI tutorial chapter 4
Python

Python Comments: Single-Line, Multi-Line and Docstrings

Python comments are notes inside your code that Python ignores when it runs the program. A single-line comment starts with #, a multi-line comment is several # lines or a triple-quoted string, and a docstring is a special string that documents a function or module. Good comments explain why, not what. Single-line comments with # […]

Python in Excel: Use the PY Function for Data Analysis - Python with AI tutorial chapter 41
Python

Python in Excel: Use the PY Function for Data Analysis

Python in Excel lets you run Python code directly inside a Microsoft 365 worksheet cell with the =PY() function. The code executes in the Microsoft Cloud, reads your ranges and tables through xl(), and returns a value, a pandas DataFrame or a chart to the grid, so you can combine Excel formulas with pandas and […]

Python String Formatting: f-strings and format() Examples - Python with AI tutorial chapter 10
Python

Python String Formatting: f-strings and format() Examples

Python string formatting is how you insert values into text and control how they look: two decimal places, thousands separators, percentages, padding and alignment. Modern code uses f-strings, written with an f before the opening quote, while the older format() method is still common in templates and existing projects. This chapter covers both with business-style […]