Flyttet python-kurset ut av samlerepoet

This commit is contained in:
2025-03-04 15:18:01 +01:00
parent c9cc068203
commit f9eb912b6a
38 changed files with 3 additions and 1164 deletions

34
notes/01_introduction.py Normal file
View File

@@ -0,0 +1,34 @@
"""
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))