summaryrefslogtreecommitdiffstats
path: root/upg1.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2020-02-05 13:12:58 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2020-02-05 13:12:58 +0100
commit6f3d4f70c8a57bf0bc01d510e3d27753fe0bfc5b (patch)
tree25631ecc3299c468b24aceb63a0ef8841f250964 /upg1.py
parent4c12ef4ac7008dc797e83f400312d25ae37493c6 (diff)
downloadtdde44-6f3d4f70c8a57bf0bc01d510e3d27753fe0bfc5b.tar.gz
Move uppgifter to separate files
Diffstat (limited to 'upg1.py')
-rw-r--r--upg1.py148
1 files changed, 0 insertions, 148 deletions
diff --git a/upg1.py b/upg1.py
deleted file mode 100644
index d6c7558..0000000
--- a/upg1.py
+++ /dev/null
@@ -1,148 +0,0 @@
-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)
-
-
-def second_in_list(values):
- return values[1]
-
-def last_in_list(values):
- return values[-1]
-
-def second_last_in_list(values):
- return values[-2]
-
-def n_in_list(values, n):
- return values[n]
-
-def three_first_in_list(values):
- return values[:3]
-
-def three_last_in_list(values):
- return values[-3:]
-
-def but_five_last_in_list(values):
- return values[:-5]
-
-def every_other_in_list(values):
- return values[::2]
-
-def two_around_n_in_list(values, n):
- return values[n-2:n+3]
-
-def new_list_with_n(values, a_value):
- return values + [a_value]
-
-def append_n_to_list(values, a_value):
- values.append(a_value)
- return values
-
-def insert_4_on_pos_3(values):
- values.insert(3, 4)
- return values
-
-def extend_vals_to_list(values1, values2):
- values1.extend(values2)
- return values1
-
-def remove_from_third_in_list(values):
- del values[2:]
- return values
-
-def concatenate_lists(values1, values2):
- return values1 + values2
-
-import random
-def select_random(values):
- return random.choice(values)
-
-def concatenate_strings(string1, string2):
- return string1 + string2
-
-def use_the_linebreak():
- print("rad 1\nrad 2")
- return "rad 1\nrad 2"
-
-def generate_pokemon_name(prefixes, suffixes):
- return concatenate_strings(select_random(prefixes), select_random(suffixes))
-
-def first_word(s):
- return s.split(" ")[0]
-
-def join_list(vals):
- return ":".join(vals)
-
-def remove_spaces(s):
- return s.rstrip()
-
-def get_characters(s, pos, num_of_chars):
- return s[pos:pos+num_of_chars]