Use a fixed random seed when investigating a Python game
Random choices make a game varied, but they can also make a bug difficult to reproduce. A fixed […]
Original companion articles exploring the mathematics and engineering of large language models.
Random choices make a game varied, but they can also make a bug difficult to reproduce. A fixed […]
An assertion checks that a condition is true during program execution. It is useful for a small learning […]
Filtering creates a collection containing the values that satisfy a condition. Building a new list gives you a […]
Two strings that look similar to a person can differ in capitalization or surrounding spaces. A program needs […]
A guessing game needs a condition that ends the loop. Planning that condition first makes the program easier […]
An off-by-one error happens when a loop processes one more or one fewer item than intended. Python’s range […]
A function’s return value lets another part of a Python program use its result. Printing a value and […]
Python’s input function returns text. A program that expects a number must convert that text and handle the […]
A Python dictionary associates a key with a value. It can keep a running count for each distinct […]
A Python list keeps values in order and lets you access each value by its position. Understanding how […]
AI tools can explain code, but they can also do the thinking for a learner. Used well, they […]
Every programmer writes bugs. The difference between beginners and experienced coders is not avoiding mistakes, but finding and […]
Turtle graphics is a playful way to see what code does. A little pen moves around the screen […]
When you find yourself copying the same lines again and again, a function can help. A function gives […]
Computers are very good at repeating things. A loop lets you write an instruction once and have it […]
Programs become interesting when they can choose between actions. In Python, if statements make those choices. […]
A program that always does the same thing gets boring quickly. Input lets it respond to the person […]
A variable lets a program remember something. It is one of the first big ideas in Python, and […]
Before writing any Python, it helps to understand what a program really is. At heart, it is an […]
You do not need to install anything to write your first Python program. A modern web browser and […]
Les outils d’IA peuvent expliquer du code, mais ils peuvent aussi réfléchir à la place de l’apprenant. Bien […]
Tous les programmeurs écrivent des bogues. La différence entre un débutant et un codeur expérimenté n’est pas d’éviter […]
Turtle est une façon ludique de voir ce que fait le code. Un petit crayon se déplace à […]
Quand vous copiez les mêmes lignes encore et encore, une fonction peut aider. Une fonction donne un nom […]
Les ordinateurs sont très bons pour répéter des choses. Une boucle permet d’écrire une instruction une seule fois […]
Les programmes deviennent intéressants quand ils peuvent choisir entre des actions. En Python, les instructions if permettent ces […]
Un programme qui fait toujours la même chose devient vite ennuyeux. La saisie lui permet de réagir à […]
Une variable permet à un programme de se souvenir de quelque chose. C’est l’une des premières grandes notions […]
Avant d’écrire du Python, il est utile de comprendre ce qu’est vraiment un programme. Au fond, c’est un […]
Il n’est pas nécessaire d’installer quoi que ce soit pour écrire un premier programme Python. Un navigateur récent […]