diff --git a/Week02/types_hilmican_karadag.py b/Week02/types_hilmican_karadag.py new file mode 100644 index 000000000..2241fa306 --- /dev/null +++ b/Week02/types_hilmican_karadag.py @@ -0,0 +1,4 @@ +my_int = 10 +my_float = 3.14 +my_bool = True +my_complex = 3 + 9j \ No newline at end of file diff --git a/Week03/pyramid_hilmican_karadag.py b/Week03/pyramid_hilmican_karadag.py new file mode 100644 index 000000000..2a6fe2ffb --- /dev/null +++ b/Week03/pyramid_hilmican_karadag.py @@ -0,0 +1,11 @@ +def calculate_pyramid_height(number_of_blocks): + + height = 1 + + while number_of_blocks >= x: + + number_of_blocks = number_of_blocks - x + + height = height + 1 + + return height \ No newline at end of file diff --git a/Week03/sequences_hilmican_karadag.py b/Week03/sequences_hilmican_karadag.py new file mode 100644 index 000000000..13d3168bf --- /dev/null +++ b/Week03/sequences_hilmican_karadag.py @@ -0,0 +1,26 @@ +def remove_duplicates(seq: list) -> list: + """ + This function removes duplicates from a list. + """ + result = [] + for item in seq: + if item not in result: + result.append(item) + return result + + +def list_counts(seq: list) -> dict: + """ + This function counts the number of occurrences of each item in a list. + """ + counts = {} + for item in seq: + counts[item] = counts.get(item, 0) + 1 + return counts + + +def reverse_dict(d: dict) -> dict: + """ + This function reverses the keys and values of a dictionary. + """ + return {value: key for key, value in d.items()} \ No newline at end of file