diff --git a/2019/Julia/README.md b/2019/Julia/README.md deleted file mode 100644 index fa90edd..0000000 --- a/2019/Julia/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# JuliaKursPVV -All the files used in the Julia Course for PVV. diff --git a/2019/PythonIntro/README.md b/2019/PythonIntro/README.md deleted file mode 100644 index 0b41bec..0000000 --- a/2019/PythonIntro/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Notes for introductory to Python - -The cource was held by Torstein N-H 27.09.2019. -These notes were used loosely and are included for future reference. diff --git a/2019/PythonIntro/notes/00_toolchain.md b/2019/PythonIntro/notes/00_toolchain.md deleted file mode 100644 index 7133e73..0000000 --- a/2019/PythonIntro/notes/00_toolchain.md +++ /dev/null @@ -1,44 +0,0 @@ -# Tools needed to work efficiently with python - -## Python -The interpreter, needed to run any python program. - -### MacOS / Linux / BSD -Install the newest python available from your package manager. -At the moment 3.6 or 3.7. - -### Windows / MacOS -Install the newest version from [the python foundation](https://www.python.org/downloads/). - -## PIP -A package manager for python libraries (and more). Maybe the best part of python. - -It comes with most new installations of python, if not try the following: - -### MacOS / Linux / BSD -Install the newest python available from your package manager. -Note that, if python 2 is installed pip will install packages for python2 and pip3 packages for python3. - -### Windows -It might come with the python installation. - -Try -``` -python3 -m pip install -``` -If not, try installing it from wsl. - -If all else fails, it probably includes running random binary scripts as administrator, good luck. - -## A good editor -Learning python is mostly useless if you cant write something in it, find a good editor. - -Recommendations: -- PyCharm -- Spyder -- Thonny -- VSCode (or VSCodium) -- Atom -- Emacs -- Vim -- Notepad++ \ No newline at end of file diff --git a/2019/PythonIntro/notes/01_introduction.py b/2019/PythonIntro/notes/01_introduction.py deleted file mode 100644 index b535d38..0000000 --- a/2019/PythonIntro/notes/01_introduction.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -This is a multiline string -It is customary to use start the file with a multiline string for documentation. -""" - -"And this a single line string" - -'Both types of string can be written with single quotes as well' - -"This string contains a \" escaped with a \\ " - -"If i want a newline\nI can get it along with a\t\tdouble tab in the middle of a line." -r"This is a literal string, i can write \n without a newline." - -# Comments are nicer for documentation as they are harder to mistake for code. - -# This is an integer -4 - -# This is a float -3.14 - -# And this an integer bound to a variable -a = 4 - -# Most data can be printed with the print function -print("Hello world") - -# Arithmetic works as expected -print(4 * 4 + 1 * 3) - -# Note that exponentials and rounding are weird -print(3 ** 2) -print(int(2.9)) \ No newline at end of file diff --git a/2019/PythonIntro/notes/02_controlFlow.py b/2019/PythonIntro/notes/02_controlFlow.py deleted file mode 100644 index b37e46f..0000000 --- a/2019/PythonIntro/notes/02_controlFlow.py +++ /dev/null @@ -1,69 +0,0 @@ -""" -Examples of conditionals and loops in python -""" - - -# This is an if statement -if True: - print("This is true") - - print("Noe mer her...") - -# And this another one -if False: - print("This will never be printed") - -# Conditions can be more complex -if 1 in [3, 2, 1, 0] and "a" != "B": - print("This should happen even though it is needlessly complex") - -# And have multiple terms -if False: - pass -elif 2 + 2 == 5: - five = 2 + 2 -else: - pass - -# Loops also exist, the most normal is for -for x in range(1, 11): - for y in range(1, 11): - print(x * y, end=" \t\t") - print() - -for x in ["a", "b", "c"]: - print(x) - -# Another example -for y in ["Det", "var", "en", "gang", "en", "liste"]: - print(y, end=" ") -print() - -# Loops can have unknown length -i = 0 -while i <= 10: - print("i is <= 10") - i += 1 - -# The can also be made infinite -while True: - if i < 5: - break - - print("i > 5") - if False: - continue - i -= 1 - - -# Loops can have an else clause -while True: - break -else: - print("This wont happens because of the break.") - -for i in range(2): - if i < -1000: - break -else: - print("This will be printed because the loop exits from its condition, not a break.") \ No newline at end of file diff --git a/2019/PythonIntro/notes/03_functions.py b/2019/PythonIntro/notes/03_functions.py deleted file mode 100644 index edbe296..0000000 --- a/2019/PythonIntro/notes/03_functions.py +++ /dev/null @@ -1,47 +0,0 @@ -""" -About functions in python -""" - -# Users may define their own custom functions -def temp(): - return 3 - -# And they may be called after they are defined -print(temp()) - -# They take arguments -def temp2(x, y): - return x * y - -temp2(1, 4) - -# And be used lazily -def foo(y): - return bar(y) - 1 -# foo may not be called here because bar does not yet exist -# print(foo(5)) -def bar(x): - return x + 1 - -print(foo(5)) - -# Type hinting is supported (but not enforced) -def strong_typed(text: str, n: int) -> str: - nstr = str() - for _ in range(n): - nstr += text - - return nstr -print(strong_typed("Hello world ", 4)) - -# Functions can take any number of arguments, optional arguments and and keyword arguments -def fancy_func(a, b="Hello", c: int = 8) -> None: - d = a + c - print(b, d) -fancy_func(1, c=6) - -# They don't even need names -print((lambda x, y : x * y)(2, 3)) - -# Though lambdas are cool, they are rarely used in python -# Decorators are often cleaner diff --git a/2019/PythonIntro/notes/04_1_objectorientation.py b/2019/PythonIntro/notes/04_1_objectorientation.py deleted file mode 100644 index b2d8d74..0000000 --- a/2019/PythonIntro/notes/04_1_objectorientation.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -In python, all things are object. -This means that all functionality associated with a piece of data is stored with the data. -""" - -# Making a new integer with the int constructor: - -a = int(5) -b = int(4) - -# Adding them together -print(a + b) -# Or without the read macro and function call: -print(a.__add__(b).__repr__()) - -# The most useful method ever -print("Hello {}\nI am {}".format("people who are still here", "the master of the .format method on strings")) \ No newline at end of file diff --git a/2019/PythonIntro/notes/04_2_makingObjects.py b/2019/PythonIntro/notes/04_2_makingObjects.py deleted file mode 100644 index d4db65b..0000000 --- a/2019/PythonIntro/notes/04_2_makingObjects.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Skippable if out of time, hot to define ones own objects. -""" - -from __future__ import annotations - -class MyVector(list): - a = 0 - - def __init__(self, dim: int, data: list): - if dim != len(data): - raise ValueError("Wrong dimensions in the vector!!!") - self.dim = dim - self.data = data - - def __add__(self, other: MyVector): - if self.dim != other.dim: - return None - else: - return MyVector(self.dim, [a + b for a, b in zip(self.data, other.data)]) - - def __repr__(self): - return "A vector of dimension {} with data:\n{}".format(self.dim, self.data) - - -a = MyVector(3, [1, 2, 3]) -b = MyVector(3, [-1, -4, 8]) - -print(a) -print(b) - -print(a + b) diff --git a/2019/PythonIntro/notes/05_1_datastructures.py b/2019/PythonIntro/notes/05_1_datastructures.py deleted file mode 100644 index bcfbdc0..0000000 --- a/2019/PythonIntro/notes/05_1_datastructures.py +++ /dev/null @@ -1,79 +0,0 @@ -""" -Good built in data structures is among the most important things in a good language. -Python has several. -""" - -# The list -a = list() -a = [] -a = [1, 3, 4, 5 ,6] - -# They act like expected -for item in a: - print(item) -print("\n\n") - -# They can contain different types -b = [1, "Hello", a, 3.14, lambda a : a + 1] - -for item in b: - print(item) - -# And be mutated -a.append(8) -a.extend(["Hello", "World"]) -a[1] = 100 - -print(a) - -print(a[:5]) - -print("\n\n\n") - -# They are objects and can be inherited as such -print(dir(a)) - -class MyList(list): - def __repr__(self): - return "This is a useless representation" - #pass - -b = MyList(a) -print(b) - - -# The dictionary -# A mutable fast type agnostic hashed map -a = dict() -a = {} -a = {2: "Hello world", 3: b, 8: 6.12345} -# Note that all keys must be hashable -# a[["Not working"]] = 3 -a[3] = ["This might work", "I think"] -print(a) - -# They can be mutated -a[2] = 5 -del a[3] - -print(a) - -# The keys and values can be easily red -print(a.keys()) -print(a.values()) - - -# The set - -# They act like keys in dictionaries, assuming this makes using them easy -a = set() -a = {'apple', 'orange', 'apple', 'banana', 3, 3, 3, 3, 3} -print(a) - -# Lists and set can be made from each other -a = [1, 2, 3, 2, 1, 2, 3, 2, 1] -b = set(a) -c = list(b) -print(a) -print(b) -print(c) diff --git a/2019/PythonIntro/notes/05_2_usefulFunctions.py b/2019/PythonIntro/notes/05_2_usefulFunctions.py deleted file mode 100644 index 76fcffe..0000000 --- a/2019/PythonIntro/notes/05_2_usefulFunctions.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -Some useful functions that should be mentioned -Most are used on lists -""" - -# zip -for a, b in zip([1, 2, 3, 4], [3, 2, 1]): - print("Found {} and {}, added it is {}.".format(a, b, a+b)) - -# map -print() -mapped = map(lambda x: 2 * x, [1, 2, 0]) -print(mapped) -print(list(mapped)) - -print() -mapped = map(lambda a, b: a - b, [5, 3, 0], [2, 3, -5, 8]) -print(mapped) -print(list(mapped)) - -# filter -print() -filtered = filter(lambda x: x == 3 or x is not None and x % 3 == 1, [3, 4, None, 11, 12, 13]) -print(filtered) -print(list(filtered)) - -# div. normal utils -print() -print(len([1, 2, 3])) -print(max([1, 2, 3])) -print(min([1, 2, 3])) -print(sorted([1, 3, 2])) \ No newline at end of file diff --git a/2019/PythonIntro/notes/06_io.py b/2019/PythonIntro/notes/06_io.py deleted file mode 100644 index 7b4756f..0000000 --- a/2019/PythonIntro/notes/06_io.py +++ /dev/null @@ -1,32 +0,0 @@ -""" -IO is boring but useful, here is how. -""" - -# Input and output from the user is easy. -a = input("Some prompt here: ") -print(a) - -# Input from files are a bit more tricky - -# The way taught in ITGK -f = open("file.txt") -f.close() - -# The correct way - - -with open("file.txt", "r") as f: - lines = f.readlines() - for line in lines: - print(line) - -# Or even better -with open("file.txt", "r") as f: - for line in f: - print(line) - -# Even better -with open("newFile.txt", 'w') as f: - f.write("This is a new file\nI like it.\n") - -# There are four modes of reading, r, w, a and r+ \ No newline at end of file diff --git a/2019/PythonIntro/notes/07_importing.py b/2019/PythonIntro/notes/07_importing.py deleted file mode 100644 index 9183186..0000000 --- a/2019/PythonIntro/notes/07_importing.py +++ /dev/null @@ -1,21 +0,0 @@ -""" -It is easier to reuse code and structure projects in multiple files. -""" - -# We can import our own code - -funcs = __import__("03_functions") - -print("\n\n") -funcs.fancy_func(3) -print("\n\n") - -import pandas -import numpy as np - -print(np.pi) - -from numpy import e -print(e) - -# Libraries makes life easier, use pip for everything always \ No newline at end of file diff --git a/2019/PythonIntro/notes/file.txt b/2019/PythonIntro/notes/file.txt deleted file mode 100644 index 29256bc..0000000 --- a/2019/PythonIntro/notes/file.txt +++ /dev/null @@ -1,45 +0,0 @@ -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. -Ornare suspendisse sed nisi lacus sed viverra tellus. Faucibus scelerisque eleifend donec pretium vulputate sapien. Mollis -nunc sed id semper. Quisque id diam vel quam elementum pulvinar etiam. Nibh sit amet commodo nulla facilisi nullam vehicula. -Porta lorem mollis aliquam ut porttitor. Senectus et netus et malesuada. Feugiat nibh sed pulvinar proin gravida hendrerit. -Sollicitudin aliquam ultrices sagittis orci a scelerisque purus semper eget. Arcu ac tortor dignissim convallis aenean et -tortor. Dictum non consectetur a erat nam at. Sagittis purus sit amet volutpat consequat mauris nunc. Nullam non nisi est -sit amet facilisis. Mi eget mauris pharetra et. Id consectetur purus ut faucibus pulvinar elementum integer enim. Enim -facilisis gravida neque convallis a cras semper auctor neque. Nunc vel risus commodo viverra maecenas accumsan lacus vel. -Consequat id porta nibh venenatis cras sed felis eget. - -Mauris cursus mattis molestie a iaculis at. Enim nunc faucibus a pellentesque sit amet porttitor. Et ligula ullamcorper -malesuada proin libero nunc consequat. Pretium vulputate sapien nec sagittis aliquam malesuada bibendum arcu. Quam -viverra orci sagittis eu volutpat. Tellus in hac habitasse platea dictumst vestibulum rhoncus. Commodo ullamcorper a -lacus vestibulum. Mi eget mauris pharetra et ultrices. Quisque non tellus orci ac. Adipiscing bibendum est ultricies -integer quis auctor elit. Malesuada fames ac turpis egestas sed tempus urna et. Iaculis nunc sed augue lacus viverra -vitae congue eu consequat. - -Sit amet nisl purus in mollis nunc sed id. Viverra nibh cras pulvinar mattis nunc sed blandit libero volutpat. Elit -pellentesque habitant morbi tristique senectus et netus. Nec feugiat nisl pretium fusce id velit ut tortor. Et netus et -malesuada fames ac turpis egestas sed tempus. Sapien nec sagittis aliquam malesuada. Malesuada proin libero nunc -onsequat interdum varius sit amet. Sit amet porttitor eget dolor morbi non arcu risus. Id diam vel quam elementum. -Massa id neque aliquam vestibulum morbi blandit cursus risus at. Morbi leo urna molestie at elementum eu facilisis sed. -Odio euismod lacinia at quis. Et tortor consequat id porta nibh. Laoreet suspendisse interdum consectetur libero id -faucibus nisl tincidunt eget. Lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit. Id nibh tortor id -aliquet lectus proin. Pretium nibh ipsum consequat nisl vel pretium lectus quam id. Vitae congue eu consequat ac felis -donec et odio. Mauris pellentesque pulvinar pellentesque habitant morbi tristique senectus et. - -Vel eros donec ac odio tempor orci dapibus. Euismod lacinia at quis risus sed vulputate odio ut enim. Vel pharetra vel -turpis nunc eget. Justo nec ultrices dui sapien. Donec enim diam vulputate ut pharetra sit amet. Consectetur adipiscing -elit duis tristique. Ipsum nunc aliquet bibendum enim facilisis gravida neque convallis. Lorem mollis aliquam ut -porttitor leo a diam sollicitudin tempor. Integer vitae justo eget magna fermentum iaculis eu. Id faucibus nisl tincidunt -eget nullam non nisi. Tempus iaculis urna id volutpat lacus. Diam sit amet nisl suscipit adipiscing bibendum est. -Tellus orci ac auctor augue mauris. Accumsan sit amet nulla facilisi morbi tempus iaculis urna id. Fermentum iaculis eu -non diam phasellus vestibulum lorem sed. Iaculis urna id volutpat lacus laoreet non curabitur gravida. Id faucibus nisl -tincidunt eget. - -Massa vitae tortor condimentum lacinia quis vel eros. Pulvinar pellentesque habitant morbi tristique senectus et netus. -Tincidunt dui ut ornare lectus sit amet est placerat in. Pellentesque elit eget gravida cum sociis. Malesuada fames ac -turpis egestas sed. Et odio pellentesque diam volutpat commodo sed egestas egestas fringilla. Augue lacus viverra vitae -congue eu consequat ac felis. Tempor orci dapibus ultrices in iaculis nunc sed augue. Odio ut enim blandit volutpat -maecenas volutpat blandit aliquam. Accumsan sit amet nulla facilisi morbi tempus. Habitant morbi tristique senectus -et netus et malesuada fames. Elementum facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Mi tempus -imperdiet nulla malesuada pellentesque elit eget. Tristique sollicitudin nibh sit amet. Porttitor massa id neque aliquam -vestibulum morbi blandit cursus. Proin sed libero enim sed. Neque gravida in fermentum et sollicitudin ac orci. -Neque volutpat ac tincidunt vitae semper quis lectus nulla. A diam maecenas sed enim ut sem viverra. \ No newline at end of file diff --git a/2019/PythonIntro/notes/kurstekst.txt b/2019/PythonIntro/notes/kurstekst.txt deleted file mode 100644 index 53e25e4..0000000 --- a/2019/PythonIntro/notes/kurstekst.txt +++ /dev/null @@ -1,6 +0,0 @@ -Kurstekst for introkurs i Python - - -Har du lyst til å lære å programmere i Python? Synes du ITGK-forelesningene går for sent, eller ønsker du å pusse opp glemte kunnskaper? -Da er dekke kurset for deg. -Kurset går gjennom språkets oppbygging fra kommentarer til overlagring av operatorer, ingen forkunnskaper kreves. diff --git a/2019/PythonIntro/notes/newFile.txt b/2019/PythonIntro/notes/newFile.txt deleted file mode 100644 index ab3c0af..0000000 --- a/2019/PythonIntro/notes/newFile.txt +++ /dev/null @@ -1,2 +0,0 @@ -This is a new file -I like it. diff --git a/2019/PythonIntro/notes/requirements.txt b/2019/PythonIntro/notes/requirements.txt deleted file mode 100644 index f3f0d0f..0000000 --- a/2019/PythonIntro/notes/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -asn1crypto<=0.24.0 -astroid>=2.2.5 -attrs diff --git a/2019/PythonIntro/notes/tempCodeRunnerFile.py b/2019/PythonIntro/notes/tempCodeRunnerFile.py deleted file mode 100644 index 37ace18..0000000 --- a/2019/PythonIntro/notes/tempCodeRunnerFile.py +++ /dev/null @@ -1 +0,0 @@ -pi \ No newline at end of file diff --git a/2019/Julia/Code/1.HelloWorld.jl b/Code/1.HelloWorld.jl similarity index 100% rename from 2019/Julia/Code/1.HelloWorld.jl rename to Code/1.HelloWorld.jl diff --git a/2019/Julia/Code/10.structs1.jl b/Code/10.structs1.jl similarity index 100% rename from 2019/Julia/Code/10.structs1.jl rename to Code/10.structs1.jl diff --git a/2019/Julia/Code/11.structs2.jl b/Code/11.structs2.jl similarity index 100% rename from 2019/Julia/Code/11.structs2.jl rename to Code/11.structs2.jl diff --git a/2019/Julia/Code/12.structs3.jl b/Code/12.structs3.jl similarity index 100% rename from 2019/Julia/Code/12.structs3.jl rename to Code/12.structs3.jl diff --git a/2019/Julia/Code/13.fileIO.jl b/Code/13.fileIO.jl similarity index 100% rename from 2019/Julia/Code/13.fileIO.jl rename to Code/13.fileIO.jl diff --git a/2019/Julia/Code/14.IOBuffer.jl b/Code/14.IOBuffer.jl similarity index 100% rename from 2019/Julia/Code/14.IOBuffer.jl rename to Code/14.IOBuffer.jl diff --git a/2019/Julia/Code/15.lambdas.jl b/Code/15.lambdas.jl similarity index 100% rename from 2019/Julia/Code/15.lambdas.jl rename to Code/15.lambdas.jl diff --git a/2019/Julia/Code/16.Macro.jl b/Code/16.Macro.jl similarity index 100% rename from 2019/Julia/Code/16.Macro.jl rename to Code/16.Macro.jl diff --git a/2019/Julia/Code/17.Broadcast.jl b/Code/17.Broadcast.jl similarity index 100% rename from 2019/Julia/Code/17.Broadcast.jl rename to Code/17.Broadcast.jl diff --git a/2019/Julia/Code/18.Unicode.jl b/Code/18.Unicode.jl similarity index 100% rename from 2019/Julia/Code/18.Unicode.jl rename to Code/18.Unicode.jl diff --git a/2019/Julia/Code/19.Packages.txt b/Code/19.Packages.txt similarity index 100% rename from 2019/Julia/Code/19.Packages.txt rename to Code/19.Packages.txt diff --git a/2019/Julia/Code/2.functions.jl b/Code/2.functions.jl similarity index 100% rename from 2019/Julia/Code/2.functions.jl rename to Code/2.functions.jl diff --git a/2019/Julia/Code/3.arithmetic.jl b/Code/3.arithmetic.jl similarity index 100% rename from 2019/Julia/Code/3.arithmetic.jl rename to Code/3.arithmetic.jl diff --git a/2019/Julia/Code/4.strings.jl b/Code/4.strings.jl similarity index 100% rename from 2019/Julia/Code/4.strings.jl rename to Code/4.strings.jl diff --git a/2019/Julia/Code/5.arrays.jl b/Code/5.arrays.jl similarity index 100% rename from 2019/Julia/Code/5.arrays.jl rename to Code/5.arrays.jl diff --git a/2019/Julia/Code/6.dicts.jl b/Code/6.dicts.jl similarity index 100% rename from 2019/Julia/Code/6.dicts.jl rename to Code/6.dicts.jl diff --git a/2019/Julia/Code/7.sets.jl b/Code/7.sets.jl similarity index 100% rename from 2019/Julia/Code/7.sets.jl rename to Code/7.sets.jl diff --git a/2019/Julia/Code/8.controllflow.jl b/Code/8.controllflow.jl similarity index 100% rename from 2019/Julia/Code/8.controllflow.jl rename to Code/8.controllflow.jl diff --git a/2019/Julia/Code/9.scopes.jl b/Code/9.scopes.jl similarity index 100% rename from 2019/Julia/Code/9.scopes.jl rename to Code/9.scopes.jl diff --git a/2019/Julia/LiveCode/test.jl b/LiveCode/test.jl similarity index 100% rename from 2019/Julia/LiveCode/test.jl rename to LiveCode/test.jl diff --git a/README.md b/README.md index 398b4eb..fa90edd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,2 @@ -# Kurs på PVV - -Dette er et enkelt lite repository for å samle tidligere kursmateriale. - - +# JuliaKursPVV +All the files used in the Julia Course for PVV.