Core by Critic
ChaptersStreak: 0 days

Ultimate Core Python

All chapters and sections

Chapter 0 · 39 questions Start Here

  1. 0.1What is a program?
  2. 0.2What is Python?
  3. 0.3How to read this book
  4. 0.4Installing Python
  5. 0.5Two ways to run Python
  6. 0.6Setting up your editor: VS Code
  7. 0.7Getting help
  8. 0.8Your setup checklist
  9. +Practice

Chapter 1 · 54 questions Your First Program

  1. 1.1Hello, World
  2. 1.2Printing text
  3. 1.3Printing numbers and calculations
  4. 1.4Printing several things at once
  5. 1.5Emojis and other languages
  6. 1.6Comments
  7. 1.7How Python reads your file
  8. 1.8Your first errors
  9. 1.9What happens when you run a program
  10. 1.10The shell shows things differently
  11. +Practice

Chapter 2 · 53 questions Values and Types

  1. 2.1Values: the things programs work with
  2. 2.2Asking for the type: type()
  3. 2.3Integers: int
  4. 2.4Floating-point numbers: float
  5. 2.5Text: str
  6. 2.6True or false: bool
  7. 2.7Nothing at all: None
  8. 2.8Complex numbers: complex
  9. 2.9Mixing types in a calculation
  10. 2.10Same value, different spellings
  11. 2.11How Python stores values
  12. +Practice

Chapter 3 · 54 questions Variables and Names

  1. 3.1Giving a value a name
  2. 3.2How assignment works
  3. 3.3Using variables
  4. 3.4Changing a variable
  5. 3.5Variables are labels, not boxes
  6. 3.6Dynamic typing
  7. 3.7Rules for names
  8. 3.8Naming conventions
  9. 3.9Don't reuse built-in names
  10. 3.10Several assignments at once
  11. 3.11Updating a variable: += and friends
  12. 3.12Deleting a name: del
  13. 3.13Constants
  14. 3.14The shell's underscore
  15. 3.15What happens in memory
  16. +Practice

Chapter 4 · 53 questions Operators and Expressions

  1. 4.1Expressions
  2. 4.2Arithmetic operators
  3. 4.3Two kinds of division
  4. 4.4The remainder operator: %
  5. 4.5Powers: **
  6. 4.6The type of an expression
  7. 4.7Built-in number functions
  8. 4.8Assignment operators
  9. 4.9Bitwise operators
  10. 4.10Precedence: what's done first
  11. 4.11Operators on text
  12. 4.12What Python does with an operator
  13. +Practice

Chapter 5 · 55 questions Comparisons, Logic and Truthiness

  1. 5.1Asking a question: comparison operators
  2. 5.2Comparing numbers
  3. 5.3Comparing strings
  4. 5.4Comparing different types
  5. 5.5Chained comparisons
  6. 5.6Combining answers: and, or, not
  7. 5.7Short-circuit evaluation
  8. 5.8Truthiness
  9. 5.9What and and or really give back
  10. 5.10A very common bug
  11. 5.11Identity: is and is not
  12. 5.12Membership: in and not in
  13. 5.13How Python does logic
  14. +Practice

Chapter 6 · 58 questions Input and Type Conversion

  1. 6.1Asking the user: input()
  2. 6.2input() always gives you text
  3. 6.3Text to whole number: int()
  4. 6.4Text to decimal number: float()
  5. 6.5Numbers to text: str()
  6. 6.6Anything to true or false: bool()
  7. 6.7Converting between number types
  8. 6.8Reading other number bases
  9. 6.9What Python converts for you, and what it never does
  10. 6.10Several values on one line
  11. 6.11Cleaning up what the user typed
  12. 6.12Looking before you convert
  13. 6.13Built-in functions
  14. 6.14Common mistakes
  15. 6.15Putting it together
  16. 6.16How input and conversion work
  17. +Practice

Chapter 7 · 60 questions Strings I: Making Strings

  1. 7.1What a string is
  2. 7.2Single quotes and double quotes
  3. 7.3Escape sequences
  4. 7.4Strings over several lines: triple quotes
  5. 7.5Raw strings
  6. 7.6Measuring a string: len()
  7. 7.7Joining strings: +
  8. 7.8Repeating strings: *
  9. 7.9Comparing and searching, briefly
  10. 7.10A first look at f-strings
  11. 7.11Strings cannot be changed
  12. 7.12Two ways to show a value: str() and repr()
  13. 7.13Common mistakes
  14. 7.14Putting it together
  15. 7.15How Python stores strings
  16. +Practice

Chapter 8 · 60 questions Strings II: Indexing and Slicing

  1. 8.1Every character has a position
  2. 8.2Counting from the end: negative indexes
  3. 8.3Going out of range: IndexError
  4. 8.4Slicing: taking a piece
  5. 8.5Leaving numbers out
  6. 8.6Negative numbers in slices
  7. 8.7Slices never raise an error
  8. 8.8The third number: step
  9. 8.9You cannot change a character
  10. 8.10Everyday recipes
  11. 8.11Common mistakes
  12. 8.12Putting it together
  13. 8.13How indexing and slicing work
  14. +Practice

Chapter 9 · 60 questions Strings III: String Methods and Unicode

  1. 9.1What a method is
  2. 9.2Changing case
  3. 9.3Trimming the ends
  4. 9.4Searching inside a string
  5. 9.5Replacing
  6. 9.6Asking what a string contains
  7. 9.7Splitting and joining
  8. 9.8Lining text up
  9. 9.9Chaining methods
  10. 9.10Characters are numbers: Unicode
  11. 9.11From characters to bytes: encoding
  12. 9.12When equal-looking strings are not equal
  13. 9.13Finding the method you need
  14. 9.14Common mistakes
  15. 9.15Putting it together
  16. 9.16How methods and Unicode work
  17. +Practice

Chapter 10 · 58 questions Errors and Debugging

  1. 10.1Three kinds of error
  2. 10.2Reading a traceback
  3. 10.3A gallery of syntax errors
  4. 10.4A gallery of exceptions
  5. 10.5Logic errors: the silent kind
  6. 10.6A method for fixing any bug
  7. 10.7Tools for finding the bug
  8. 10.8The debugger
  9. 10.9Surviving an error: a first look at try and except
  10. 10.10Asking for help well
  11. 10.11Common mistakes when debugging
  12. 10.12Putting it together
  13. 10.13How errors work inside Python
  14. +Practice

Chapter 11 · 60 questions Decisions: if, elif, else

  1. 11.1The if statement
  2. 11.2Indentation is the grammar
  3. 11.3Two paths: else
  4. 11.4Many paths: elif
  5. 11.5A chain or separate ifs?
  6. 11.6Decisions inside decisions: nesting
  7. 11.7Writing good conditions
  8. 11.8A decision in one line: the conditional expression
  9. 11.9The variable that might not exist
  10. 11.10An empty block: pass
  11. 11.11Patterns you will use again and again
  12. 11.12Common mistakes
  13. 11.13Putting it together
  14. 11.14How if works inside Python
  15. +Practice

Chapter 12 · 59 questions Pattern Matching: match and case

  1. 12.1Why match exists
  2. 12.2The parts of a match
  3. 12.3Matching exact values
  4. 12.4Capturing: a pattern can give you a value
  5. 12.5Guards: a pattern plus a condition
  6. 12.6Matching the shape of data
  7. 12.7Matching by type
  8. 12.8A glimpse of what else patterns can do
  9. 12.9match or if?
  10. 12.10Common mistakes
  11. 12.11Putting it together
  12. 12.12How match works inside Python
  13. +Practice

Chapter 13 · 61 questions while Loops, break and continue

  1. 13.1Why we need loops
  2. 13.2The while statement
  3. 13.3The condition is only checked at the top
  4. 13.4Infinite loops
  5. 13.5The standard patterns
  6. 13.6Loops that depend on the user
  7. 13.7Leaving early: break
  8. 13.8Skipping ahead: continue
  9. 13.9Assigning inside the condition: the walrus
  10. 13.10Taking a number apart
  11. 13.11Off by one
  12. 13.12A float is a poor loop counter
  13. 13.13A brief look ahead: else on a loop
  14. 13.14Common mistakes
  15. 13.15Putting it together
  16. 13.16How a loop works inside Python
  17. +Practice

Chapter 14 · 60 questions for Loops and range

  1. 14.1The for statement
  2. 14.2range(): numbers on demand
  3. 14.3for or while?
  4. 14.4The patterns, in for form
  5. 14.5Looping by position
  6. 14.6The loop variable
  7. 14.7break and continue in a for loop
  8. 14.8Classic problems
  9. 14.9Common mistakes
  10. 14.10Putting it together
  11. 14.11How for and range work inside Python
  12. +Practice

Chapter 15 · 61 questions Nested Loops and the Loop else

  1. 15.1A loop inside a loop
  2. 15.2Staying on the same line
  3. 15.3Rows and columns
  4. 15.4When the inner loop depends on the outer loop
  5. 15.5Every pair
  6. 15.6break in a nested loop
  7. 15.7The else of a loop
  8. 15.8Mixing for and while
  9. 15.9How much work is a nested loop?
  10. 15.10Common mistakes
  11. 15.11Choosing the right loop: a summary
  12. 15.12Putting it together
  13. 15.13How nested loops work inside Python
  14. +Practice