summaryrefslogtreecommitdiffstats
path: root/upg2_1.py
diff options
context:
space:
mode:
Diffstat (limited to 'upg2_1.py')
-rw-r--r--upg2_1.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/upg2_1.py b/upg2_1.py
new file mode 100644
index 0000000..7a66bd0
--- /dev/null
+++ b/upg2_1.py
@@ -0,0 +1,55 @@
+def greeting(name):
+ return "Hej " + name + (", visste du att M är min favoritbokstav" if name[0] == "M" else "") + "!"
+
+def is_this_a_long_list(values):
+ return len(values) > 5
+
+def get_grade(score):
+ if score > 80:
+ return "VG"
+ if score >= 50:
+ return "G"
+ return "U"
+
+def days_in_month(month):
+ return {"januari": 31,
+ "februari": 28,
+ "mars": 31,
+ "april": 30,
+ "maj": 31,
+ "juni": 30,
+ "juli": 31,
+ "augusti": 31,
+ "september": 30,
+ "oktober": 31,
+ "november": 30,
+ "december": 31,
+ }[month]
+
+def odd(value):
+ return value % 2 != 0
+
+def get_integer_description(value):
+ if value % 2 == 0 and value > 0:
+ return 2
+ if value % 2 != 0 and value > 0:
+ return 1
+ if value == 0:
+ return 0
+ if value % 2 != 0 and value < 0:
+ return -1
+ if value % 2 == 0 and value < 0:
+ return -2
+ return "yeet"
+
+def appraisal_factor(rare, good_condition):
+ price = 1
+ if rare:
+ price += 0.25
+ else:
+ price -= 0.25
+ if good_condition:
+ price += 0.5
+ else:
+ price -= 0.5
+ return price