summaryrefslogtreecommitdiffstats
path: root/upg1_1.py
diff options
context:
space:
mode:
Diffstat (limited to 'upg1_1.py')
-rw-r--r--upg1_1.py72
1 files changed, 72 insertions, 0 deletions
diff --git a/upg1_1.py b/upg1_1.py
new file mode 100644
index 0000000..4a19bd8
--- /dev/null
+++ b/upg1_1.py
@@ -0,0 +1,72 @@
+import math
+
+
+def return_five():
+ return "five"
+
+
+def print_five():
+ print("five")
+
+
+def add_strings():
+ return "hej" + "san"
+
+
+def use_the_var():
+ value = 5
+ return value * 5
+
+
+def use_the_arg(a_string):
+ print(a_string)
+ return a_string
+
+
+def to_string(a_value):
+ return str(a_value)
+
+
+def to_integer(a_value):
+ return int(a_value)
+
+
+def to_float(a_value):
+ return float(a_value)
+
+
+def to_any_type(a_value, a_type):
+ return a_type(a_value)
+
+
+def print_type(a_value):
+ print(type(a_value))
+
+
+def subtract(value1, value2):
+ return value1 - value2
+
+
+def split_bill(amount, number_of_people):
+ print(amount / number_of_people)
+ return amount / number_of_people
+
+
+def round_up(value):
+ return math.ceil(value)
+
+
+def round_down(value):
+ return math.floor(value)
+
+
+def celsius_to_fahrenheit(value):
+ return value * 9/5 + 32
+
+
+def fahrenheit_to_celsius(value):
+ return (value - 32) * 5/9
+
+
+def pythagoras(x, y):
+ return math.sqrt(x ** 2 + y ** 2)