Variables
In programming an assignment creates a variable and gives it value.![](/lib/images/GitHub-Mark-Light-32px.png)
""" 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.![](/lib/images/GitHub-Mark-Light-32px.png)
""" Statements
When you type a statement,
the interpreter executes it
"""
n = 17 # statement 1
print(n) # statement 2
Operators
The + operator concatenates two strings.![](/lib/images/GitHub-Mark-Light-32px.png)
""" 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: 292 days ago