voidex/20-29 Areas/20 Programming/20.01 Python/expressions.md

30 lines
719 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: expressions
tags:
- python
- expressions
- syntax
aliases:
- expression
- evaluate
---
> [!note] Concept
> An **expression** is a combination of **values**, **variables**, and **operators** that evaluates to a single value.
>
> > [!example] Examples
> > ```python
> > 2 + 3 # 5
> > 'a' * 3 # 'aaa'
> > myAge + 1 # if myAge is an integer
> > ```
>
> > [!important] Best Practices
> > - Expressions dont store data — they compute and return a value.
> > - You can use expressions inside function calls, assignments, etc.
>
> > [!info] Related Notes
> > [[arithmeticOperators]]
> > [[booleans]]
> > [[typeConversions]]
> > [[pythonSyntaxOverview]]