← Courses

Python for AI — Beginner Foundations

Data Science

Basics · Lesson 23 of 76

Python errors

Errors are not failures — they're Python telling you exactly what it couldn't do. Learning to read them is a core skill.

Python

Run that. You'll get a NameError saying numbet is not defined. Python even points to the line. The fix is obvious once you read it: correct the spelling to number.

The pattern for every error: read the last line first (it names the problem), then look at the line number. Most errors are typos, wrong names, or missing punctuation.

Your turn: fix the typo above so it prints 10.

You’re reading for free. Sign in to keep your progress and earn a certificate when you finish.Sign in to keep my progress →