miércoles, 19 de agosto de 2026

SINTAX PYTHON TABLE

 

Python Symbols and Keywords Table (English)

CategorySymbol / KeywordCode ExampleDescription & Meaning
Control Flowifif dist_1 < dist_2:

Runs a block of code only if the specified condition evaluates to True.

Control Flowelseelse:

Runs an alternative block of code when the preceding if condition is False.

Control Flowforfor i in x:

Iterates over a sequence (such as a list or range) a specific number of times.

Control Flowwhilewhile True:

Repeats a block of code continuously as long as the given condition remains True.

Control Flowdefdef my_function(x):

Used to declare and define a new custom function.

Control Flowreturnreturn result

Exits a function and returns a result or value back to the caller.

Data Structures[ ]x = [-1.5, 0, 1.5]

Square brackets: Creates a List (an ordered collection of items).

Data Structures{ }s = {1, 2, 3}

Curly braces: Creates a Set (an unordered collection of unique items).

Data Structures( )print("Hello")

Parentheses: Used to call functions, pass arguments, or group expressions.

Operators**y = i**2

Exponentiation / Power operator (e.g., $i^2$ or $i$ raised to a power).

Operators*y = 5 * x

Multiplication operator.

Operators< / >if a < b:

Comparison operators for "less than" (<) and "greater than" (>).

Operators=a = 3

Assignment operator (stores a value or object inside a variable).

Syntax & Comments## Single line comment

Single-line comment. Python ignores any text written after this symbol on the same line.

Syntax & Comments"""""" Multi-line comment """

Triple quotes: Used for multi-line comments or docstrings.

Syntax & Comments:if x > 0:

Colon: Marks the beginning of an indented block of code (used after if, for, while, def).

No hay comentarios:

Publicar un comentario