/IN1900

UiO IN1900 // Fall 2022

Primary LanguagePython

UiO // IN1900 - Introduction to Programming with Scientific Applications

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.

Course Overview & Key Points

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
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