Repository for my IN1900 excercise solutions and related documents. Readme is primarily a personal note of course contents and things which should be committed to memory.
Python modules used
-
Math // Cmath // MatplotLib.pyplot // Numpy // Sys
-
Know how to make and import modules
-
Know how to edit where python looks for modules
Built in data structures
- Lists
- Dictionary
- Tuple
- Set
Working with strings
- F-string formatting
- Format specifiers
- print()
# f-string formatting
print(f'Evaluate {variable} at runtime')
# format specifieer
print(f'Set space for output {x:8.2f}.')
Working with files
- [with] statement
- .close()
- open()
- write()
- .read()
- .readline()
- .readlines()
Lists
- Lists are mutable
- List comprehension
- List slicing
- .append()
- .split()
- len()
# List comprehension
# new_list = = [expression for element in iterable]
my_list = [x**2 for x in range(10)]
Loops
- While-loop
- For-loop
- Mathematical sum as for-loop
- Break statement
- Continue statement
Built in functions
- eval()
- exec()
- exit()
- input()
- len()
- range()
- map()
- open()
- print()
- write()
- zip()
Exception handling
- try-except-finally
- raise
Numpy
- np.empty()
- np.linspace()
- np.mean()
- np.max()
- np.min()
- np.zeros()
# Standard import format
import numpy as np