CALCULATOR
- Addition, Subtraction, Multiplication, Division:
- Power
- // operator
- modulus
USING MATHEMATICAL FUNCITONS
- importing:
- prefixing functions/modules:
ROUNDING
INPUT
- input PYTHON vs MATLAB:
- inputting integers in PYTHON:
OUTPUT
PRINT
- print command:
- print + end = ‘’ argument vs fprintf/disp(MATLAB)
FORMATTED PRINTING
- formatted printing in MATLAB:
- old method of formatting in PYTHON:
- format specifiers in python:
NEW-STYLE FORMATTING
- old style vs new style:
- format of new formatting:
LISTS
- creating lists:
- lists PYTHON vs vectors MATLAB
- finding the number of elements in Python using len():
USING LIST ELEMENTS
- to call an element from a list
CHANGING LIST ELEMENTS
- assigning elements in lists
- .remove()
EXTENDING LISTS
- you can’t just extend it by assigning into an element index passed the original list length:
- .append()
- .insert()
CREATING LISTS
- range()
- range in lists:
- range like the colon operator
INDEXING THE END OF THE LIST
pi = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5]
- ways to access the end of the list
LIST SLICES
- list slice and the third parameter
STRINGS
- string
- strings are immutable
FUNCTIONS WITH STRINGS
- operations in strings
- .upper()
- .lower()
SPLITTING AND JOINING STRINGS
2D LISTS
- sample 2D list
- selecting samples at a certain location
COPYING LISTS IN PYTHON
- pointing to memory locations (labelling)
- how to actually copy content instead of just labelling?
TUPLES
- Tuple also immutable
- Append, insert, remove don’t work on tuples
DICTIONARIES
- dictionaries
- entering values into dictionaries:
- .keys()
- .get()
BOOLEAN LOGIC
IF-THEN-ELSE
- IF THEN ELSE IN PYTHON VS IF THEN ELSE IN MATLAB
- elif