What Is Expression

Q

What Is an expression in Python?

✍: FYIcenter.com

A

An expression in Python is a sequence of operations or method calls applied on data objects.

An expression has two impacts when executed:

  • Code statements of invoked methods get executed. This may create new data objects, update existing data objects, consume resources, etc.
  • A data object gets returned.

For example, execute following expression:

>>> [1,4,9].append(16)

Python will:

  • Execute the "list" constructor method to create a "list" data object with [1,4,9].
  • Execute the "list.append()" method to update the "list" data object by adding 16 to the end.
  • Return the "None" object.

 

Expressions, Variables and Assignment Statements

⇒⇒Python Tutorials

2017-09-09, 118👍, 0💬