PYTHON

  minte9
REMEMBERS




Variables

p33 In programming an assignment creates a variable and gives it value.
 
# An assignment creates a variable and gives it value.
# If you give an illegal name of a variable, you get a syntax error.
# An expression is a combination of values, variables, and operators.
# You can assign multiple variables in on line

# Assignment
#
message = 'Hello World!'
print(message) # Hello World!


# Illegal name variables
#
# name@ = "John" 
# class = "myClass" # SyntaxError: invalid syntax


# Expression
#
n = 17
n = n + 24
print(n) # 41


# Multiple assignement
#
a, b, c = [1, 2, 3]
assert a == 1
assert b == 2
assert c == 3

Statements

p36 A statement is a unit of code that has an effect.
 
# When you type a statement, the interpreter executes it

n = 17    # statement 1
print(n)  # statement 2 
    # 17

Operators

p39 The + operator concatenates two strings.
 
# The + operator concatenates two strings.
# The * operator performs repetitions on strings.

s1 = 'Hello'
s2 = 'World'
print(s1 + ' ' + s2) # 'Hello World'

print('Spam'*3) # 'SpamSpamSpam'

Questions     github Language
Functions
        A B C D E F
🔔
1/2