diff --git a/Week03/pyramid_cemil_koca.py b/Week03/pyramid_cemil_koca.py new file mode 100644 index 00000000..682ec92e --- /dev/null +++ b/Week03/pyramid_cemil_koca.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + remaining = number_of_blocks + + while remaining >= height + 1: + height += 1 + remaining -= height + + return height \ No newline at end of file diff --git a/Week03/sequences_cemil_koca.py b/Week03/sequences_cemil_koca.py new file mode 100644 index 00000000..187169bf --- /dev/null +++ b/Week03/sequences_cemil_koca.py @@ -0,0 +1,22 @@ +def remove_duplicates(seq): + result = [] + for item in seq: + if item not in result: + result.append(item) + return result + + +def list_counts(seq): + counts = {} + for item in seq: + if item not in counts: + counts[item] = 0 + counts[item] += 1 + return counts + + +def reverse_dict(d): + result = {} + for key in d: + result[d[key]] = key + return result \ No newline at end of file