Expressions and statements are the building blocks of a Python script. A line of code may an expression, a statement, or both.
- [Instructor] The distinction between statements…and expressions is a bit different…in every computer language.…Generally speaking, a statement is a unit of execution,…and an expression is a unit of evaluation.…In a scripting language like Python,…these definitions require further explanation.…In Python, an expression is any combination…of literals, identifiers, and operators.…Generally, this means anything…that returns a value is an expression.…This is an assignment.…It assigns a value to a variable.…
This is an operation.…You notice it has an operator, the multiplication symbol,…and so it returns the result of that operation,…the result of that multiplication.…This is an aggregate value.…In this case, it's a tuple.…This is a simple value.…This is a built-in constant value.…And this is a function call.…All function calls return a value in Python,…even if the value is none, which is the absence of value.…A statement is a line of code.…
It may be an expression,…or it may be something like the import statement…or a break or a continue.…
- Python anatomy
- Types and values
- Conditionals and operators
- Building loops
- Defining functions
- Python data structures: lists, tuples, sets, and more
- Creating classes
- Handling exceptions
- Working with strings
- File input/output (I/O)
- Creating modules
- Integrating a database with Python db-api
Skill Level Intermediate
Python: Programming Efficiently (2017)with Michele Vallisneri2h 15m Intermediate
2. Language Overview
3. Types and Values
8. Structured Data
11. String Objects
12. File I/O
13. Built-in Functions
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.