100 Basic Python Syntax Concepts

Mastering Regex for Efficient Text Processing and Data Validation in Python

Chiapeilie
Javarevisited

--

Photo by Tai Bui on Unsplash

0. Variables and Assignment:

x = 5
name = "John"

1. Data Types:

Integer (int)

Floating-point (float)

String (str)

Boolean (bool)

2. Comments:

# This is a single-line comment
"""
This is
a multi-line comment
"""

3. Arithmetic Operations:

a + b  # Addition
a - b # Subtraction
a * b # Multiplication
a / b # Division
a % b # Modulus
a ** b # Exponentiation

4. Comparison Operations:

a == b  # Equal to
a != b # Not equal to
a > b # Greater than
a < b # Less than
a >= b # Greater than or equal to
a <= b # Less than or equal to

5. Logical Operations:

a and b
a or b
not a

6. Conditional Statements:

if condition:
# do something
elif another_condition:
# do something else
else:
# do something different

7. Loops:

for i in range(5):
print(i)

while condition:
# do something

--

--

Chiapeilie
Javarevisited

Welcome to follow an ignorant programmer pretending to know everything