diff --git a/Week03/pyramid_recepkadir_altintas.py b/Week03/pyramid_recepkadir_altintas.py new file mode 100644 index 00000000..ad56d765 --- /dev/null +++ b/Week03/pyramid_recepkadir_altintas.py @@ -0,0 +1,9 @@ +def calculate_pyramid_height(number_of_blocks : int) -> int : + height = 0 + block_for_floor = 1 + while number_of_blocks >= block_for_floor : + number_of_blocks -= block_for_floor + height += 1 + block_for_floor += 1 + + return height diff --git a/Week03/sequences_recepkadir_altintas.py b/Week03/sequences_recepkadir_altintas.py new file mode 100644 index 00000000..db51a22b --- /dev/null +++ b/Week03/sequences_recepkadir_altintas.py @@ -0,0 +1,13 @@ +from collections import Counter + +def remove_duplicates(seq: list) -> list: + + return list(dict.fromkeys(seq)) + +def list_counts(seq: list) -> dict: + + return dict(Counter(seq)) + +def reverse_dict(d: dict) -> dict: + + return {value: key for key, value in d.items()}