diff --git a/Week02/types_berkay_altunbag.py b/Week02/types_berkay_altunbag.py new file mode 100644 index 00000000..47bcb099 --- /dev/null +++ b/Week02/types_berkay_altunbag.py @@ -0,0 +1,4 @@ +my_int = 8 +my_float = 7.77 +my_bool = True +my_complex = 7 + 2j \ No newline at end of file diff --git a/Week03/pyramid_berkay_altunbag.py b/Week03/pyramid_berkay_altunbag.py new file mode 100644 index 00000000..b3f3d738 --- /dev/null +++ b/Week03/pyramid_berkay_altunbag.py @@ -0,0 +1,7 @@ +def calculate_pyramid_height(number_of_blocks): + height = 0 + used = 0 + while used + (height + 1) <= number_of_blocks: + height += 1 + used += height + return height \ No newline at end of file diff --git a/Week03/sequences_berkay_altunbag.py b/Week03/sequences_berkay_altunbag.py new file mode 100644 index 00000000..0109906c --- /dev/null +++ b/Week03/sequences_berkay_altunbag.py @@ -0,0 +1,13 @@ +def remove_duplicates(lst): + return list(dict.fromkeys(lst)) + + +def list_counts(lst): + counts = {} + for item in lst: + counts[item] = counts.get(item, 0) + 1 + return counts + + +def reverse_dict(d): + return {value: key for key, value in d.items()} \ No newline at end of file