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 […]
Las herramientas de IA pueden explicar código, pero también pueden pensar por el aprendiz. Bien usadas, ayudan. Usadas […]
Todos los programadores escriben errores. La diferencia entre un principiante y un programador con experiencia no es evitarlos, […]
Turtle es una forma divertida de ver lo que hace el código. Un pequeño lápiz se mueve por […]
Cuando copias las mismas líneas una y otra vez, una función puede ayudar. Una función da nombre a […]
Las computadoras son muy buenas repitiendo cosas. Un bucle permite escribir una instrucción una sola vez y ejecutarla […]
Los programas se vuelven interesantes cuando pueden elegir entre acciones. En Python, las instrucciones if permiten esas decisiones. […]
Un programa que siempre hace lo mismo se vuelve aburrido enseguida. Pedir datos le permite reaccionar a la […]
Una variable permite que un programa recuerde algo. Es una de las primeras grandes ideas de Python, y […]
Antes de escribir Python conviene entender qué es realmente un programa. En el fondo es un algoritmo: una […]
No necesitas instalar nada para escribir tu primer programa en Python. Un navegador moderno y un editor en […]