summaryrefslogtreecommitdiffstats
path: root/upg1_1.py
blob: 4a19bd85bd34db86def641d14ea78f0b6936b531 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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)