- Python
- Language
- Hello World
- Variables ♣
- Functions
- Conditional
- Operators
- While
- Turtle
- Script Mode
- Debugging
- Strings
- Slice
- Raw Strings
- Validation
- Config
- Security
- Collections
- Lists
- Dictionaries
- Efficiency
- Tree
- Iterator
- Tuples
- References
- Functions
- Recursion
- Factorial
- Modulus
- Reassignment
- Approximate
Variables
In programming an assignment creates a variable and gives it value.
""" Variables
An assignment creates a variable and gives it value
You can assign multiple variables in one line
"""
message = 'Hello World'
print(message) # Hello World
n = 17
n = n + 24
print(n) # 41
a, b, c = [1, 2, 3] # Look Here
assert a == 1
assert b == 2
assert c == 3
Statements
A statement is a unit of code that has an effect.
""" Statements
When you type a statement,
the interpreter executes it
"""
n = 17 # statement 1
print(n) # statement 2
Operators
The + operator concatenates two strings.
""" Operators
The + operator concatenates two strings
The * operator performs repetitions on strings
"""
a = 'Hello'
b = 'World'
print(a + ' ' + b) # Hello World
print(a*3) # HelloHelloHello
Last update: 50 days ago