강좌 내용
Getting started
5 레슨Introduction to Python
What Python is, what it's used for, how to install it and how to run your first program.
Syntax, output and comments
The basic rules for writing Python: indentation, statements, how to display text and numbers with print() and how to comment your code.
Variables
How to create variables, the rules for naming them, assigning several values at once, printing them, and the difference between local and global variables.
Data types and numbers
The data types built into Python, how to check a value's type, and an in-depth look at the three numeric types: int, float and complex.
Casting and user input
Convert values between types with int(), float() and str(), and ask the user for data with input() to build interactive programs.
Strings
4 레슨Strings: the basics
How to create text in Python, multiline strings, accessing each character, measuring length and searching for words inside a text.
Slicing and modifying strings
Extract parts of a text with slicing, use negative indexes and transform strings with upper(), lower(), strip(), replace() and split().
Concatenation, f-strings and escape characters
Join text with +, insert variables and expressions with f-strings, control decimals and use escape characters for quotes, line breaks and tabs.
String methods
The methods Python provides to transform, search, validate, align, split and join text, with a complete reference table.
Booleans and operators
4 레슨Booleans
The values True and False, how comparisons produce them, which values Python treats as true or false, and how to use them to make decisions.
Arithmetic and assignment operators
What an operator is, Python's seven math operations and the shortcuts for updating variables like += and -=, including the walrus operator.
Comparison, logical, identity and membership operators
Compare values, combine conditions with and, or and not, tell == apart from is, and look for items with in.
Bitwise, ternary and operator precedence
Work directly with a number's bits, write one-line decisions with the ternary operator and understand the order in which Python evaluates an expression.
Control flow
4 레슨Conditionals: if, elif and else
Make your program decide with if, elif and else, combine conditions, nest decisions and learn the short forms and the pass statement.
The match statement
Compare a value against several cases with match and case: the default case, several values per case, extra conditions and tuple patterns.
While loops
Repeat code while a condition holds, avoid infinite loops and control the loop with break, continue and else.
For loops and range()
Loop through lists and text with for, generate number sequences with range(), and use break, continue, else and nested loops.
Data collections
8 레슨Lists: creating and accessing
What a list is, its characteristics, how to create it, measure it and read its items with indexes and ranges, and how it compares to Python's other collections.
Lists: changing, adding and removing
Change items or ranges in a list, add with append(), insert() and extend(), and remove with remove(), pop(), del and clear().
Lists: looping and comprehensions
The different ways to loop through a list with for and while, and how to create new lists in a single line with list comprehensions.
Lists: sorting, copying, joining and methods
Sort lists with sort() and sorted(), copy them without surprises, join them, learn every list method and understand how lists relate to arrays.
Tuples
Ordered collections that can't be changed: how to create them, access, 'update', unpack, loop through and join them, and their two methods.
Sets and frozensets
Unordered collections without duplicates: how to create them, add and remove items, loop through them, combine them with union, intersection and difference, and the immutable frozenset.
Dictionaries: creating, accessing and changing
Store data as key-value pairs: create dictionaries, read values with [] and get(), get keys and values, and change, add and remove items.
Dictionaries: looping, copying, nesting and methods
Loop through keys, values and pairs, copy dictionaries safely, organize data in nested dictionaries and learn every method plus dict comprehensions.
Functions
5 레슨Functions and arguments
Create your own functions with def, pass them arguments, use default values and keyword arguments, and return results with return.
*args, **kwargs and scope
Functions that accept any number of arguments, positional-only and keyword-only arguments, and where each variable lives: local, global and nonlocal scope.
Lambda functions and recursion
Write one-line functions with lambda, use them with sorted(), map() and filter(), and solve problems with functions that call themselves.
Decorators
Add behavior to a function without changing it: functions as values, the @ syntax, decorators with arguments, return values, functools.wraps and stacked decorators.
Iterators and generators
What happens inside a for loop: iterables, iterators, iter() and next(), how to build your own iterator, and generators with yield to produce values on demand.
Tools and the standard library
7 레슨Error handling: try and except
Keep your program from stopping on an error: catch exceptions with try and except, tell error types apart, use else and finally, and raise your own errors with raise.
None and advanced string formatting
The None value for representing the absence of a value, and every formatting option: thousands separators, percentages, alignment, padding and the format() method.
Modules and math
Organize your code into modules, import them in different ways, explore Python's built-in modules and use the math functions and the math module.
Dates and times
Work with dates using the datetime module: get the current date, create dates, format them with strftime(), parse them from text and do math with timedelta.
JSON
The standard format for exchanging data: turn JSON into Python with loads(), Python into JSON with dumps(), make it readable and save it to or read it from files.
Regular expressions
Search, validate and replace text patterns with the re module: findall, search, split and sub, metacharacters, special sequences, sets and the Match object.
PIP and virtual environments
Install third-party libraries with pip, save your project's dependencies in requirements.txt and isolate each project in its own virtual environment.