Phase A
Foundations
Your first lines of Python, from print to a text-adventure capstone.
What you'll be able to do
- ✓Work as a Programmer
About this course
Start from zero. By the end you can write small Python programs that take input, make decisions, loop, store data in lists and dictionaries, and recover from errors. Closes with a text-adventure capstone you build from scratch.
Curriculum
Getting Started with PythonYour first Python program, variables, numbers, strings, and a tiny interactive project. By the end of this module you can write scripts that ask for input and respond.
17 lessons
Your first Python program, variables, numbers, strings, and a tiny interactive project. By the end of this module you can write scripts that ask for input and respond.
- What Is Python?FreeTheory
- Hello PythonFreeExercise
- Naming Your ValuesFreeTheory
- Name Your ValuesExercise
- Name Your ValuesExercise
- Numbers and OperatorsTheory
- Doing MathExercise
- Strings and f-stringsTheory
- Build a MessageExercise
- Asking the UserTheory
- Temperature ConverterExercise
- Temperature ConverterExercise
- Practice RunExercise
- Practice RunExercise
- Quick RecapTheory
- Quick RecapTheory
- Build: Personalized GreeterExercise
Making DecisionsTeach your programs to choose: booleans, comparisons, if/elif/else, and combining conditions with and/or/not. 13 lessons (theory and exercise spliced). Capstone: a grade classifier that turns a number into a letter grade.
13 lessons
Teach your programs to choose: booleans, comparisons, if/elif/else, and combining conditions with and/or/not. 13 lessons (theory and exercise spliced). Capstone: a grade classifier that turns a number into a letter grade.
- True, False, and ComparisonsTheory
- True, False, and the BoolExercise
- if, elif, elseTheory
- Your First DecisionExercise
- Combining ConditionsTheory
- Combining ConditionsExercise
- Branch Ordering and NestingTheory
- Branch OrderingExercise
- TruthinessTheory
- Describe InventoryExercise
- Decision DrillsExercise
- Control Flow RecapTheory
- Build: Grade ClassifierExercise
Repeating YourselfLoops are how you make Python do the same thing many times without copying code. for loops, while loops, range, break, continue, and the accumulator pattern. Capstone: a FizzBuzz that prints the first N numbers with the classic twist. 13 lessons (theory and exercise spliced).
13 lessons
Loops are how you make Python do the same thing many times without copying code. for loops, while loops, range, break, continue, and the accumulator pattern. Capstone: a FizzBuzz that prints the first N numbers with the classic twist. 13 lessons (theory and exercise spliced).
- The for LoopTheory
- Sum to NExercise
- while LoopsTheory
- Count DigitsExercise
- Iterating Strings and the in OperatorTheory
- Count VowelsExercise
- break, continue, and Early ReturnTheory
- First Vowel and Sum Non-negativesExercise
- The Five Accumulator PatternsTheory
- Three AccumulatorsExercise
- Loop DrillsExercise
- Loops RecapTheory
- Build: FizzBuzzExercise
Collections of ThingsLists are how Python holds many values in one name. Creating, indexing, slicing, mutating, iterating, and the most common list methods. Capstone: a small shopping list manager. 13 lessons (theory and exercise spliced).
13 lessons
Lists are how Python holds many values in one name. Creating, indexing, slicing, mutating, iterating, and the most common list methods. Capstone: a small shopping list manager. 13 lessons (theory and exercise spliced).
- What Is a List?Theory
- First and LastExercise
- Iterating and Building ListsTheory
- Doubled and PositivesExercise
- SlicingTheory
- Middle and First NExercise
- List MethodsTheory
- Add Unique and Remove AllExercise
- Lists of ListsTheory
- Row Sums and Column ExtractExercise
- List DrillsExercise
- Lists RecapTheory
- Build: Shopping List ManagerExercise
Functions in DepthFunctions are how you give a name to a chunk of code and reuse it. Goes past the basics into default arguments, keyword arguments, multiple returns, local variables, and scope. Capstone: a tiny calculator module. 13 lessons (theory and exercise spliced).
13 lessons
Functions are how you give a name to a chunk of code and reuse it. Goes past the basics into default arguments, keyword arguments, multiple returns, local variables, and scope. Capstone: a tiny calculator module. 13 lessons (theory and exercise spliced).
- The Full Shape of a FunctionTheory
- Three Area FunctionsExercise
- Default ParametersTheory
- Power and GreetExercise
- Keyword ArgumentsTheory
- URL BuilderExercise
- Returning Multiple ValuesTheory
- Returning Multiple AnswersExercise
- Where Variables LiveTheory
- Running Total and Counter FactoryExercise
- Function DrillsExercise
- Functions RecapTheory
- Build: Tiny Calculator ModuleExercise
Key-Value StorageDictionaries map names to values and are the workhorse data structure for records and tables. Creating, reading, updating, deleting, iterating, nesting, and safe lookups. Capstone: a small contact book. 13 lessons (theory and exercise spliced).
13 lessons
Dictionaries map names to values and are the workhorse data structure for records and tables. Creating, reading, updating, deleting, iterating, nesting, and safe lookups. Capstone: a small contact book. 13 lessons (theory and exercise spliced).
- What Is a Dictionary?Theory
- Lookup and Make UserExercise
- Changing DictsTheory
- Incrementing Dictionary ValuesExercise
- Iterating DictsTheory
- Price Total, Most Expensive, Starts WithExercise
- Safe Lookups and the Counter PatternTheory
- Word Count and Letter FrequencyExercise
- Nested Dicts and Dicts of ListsTheory
- Average Grade and Group By LetterExercise
- Dict DrillsExercise
- Dicts RecapTheory
- Build: Contact BookExercise
Reading ErrorsEvery program breaks. Good programmers know how to read the error, find the cause, and fix it fast. Tracebacks, try/except, raising exceptions, assertions, and debugging habits. Capstone: a safe input validator. 11 lessons (theory and exercise spliced).
11 lessons
Every program breaks. Good programmers know how to read the error, find the cause, and fix it fast. Tracebacks, try/except, raising exceptions, assertions, and debugging habits. Capstone: a safe input validator. 11 lessons (theory and exercise spliced).
- Anatomy of a TracebackTheory
- Name That ExceptionExercise
- try and exceptTheory
- Safe ConversionsExercise
- Raising Your Own ExceptionsTheory
- Withdraw and Get FieldExercise
- Assertions and When to Use ThemTheory
- Set Age with AssertionsExercise
- Debugging HabitsTheory
- Error Handling DrillsExercise
- Build: Input ValidatorExercise
Your First Real ProgramBuild a small text-adventure engine one function at a time. Every lesson in this module uses everything you learned in the previous seven modules.
5 lessons
Build a small text-adventure engine one function at a time. Every lesson in this module uses everything you learned in the previous seven modules.
- Planning a Real ProgramTheory
- Describe the WorldExercise
- Moving Between RoomsExercise
- Picking Things UpExercise
- Build: The Full AdventureExercise