diff --git a/Week01/info_emin_badur.py b/Week01/info_emin_badur.py new file mode 100644 index 00000000..eb8f606a --- /dev/null +++ b/Week01/info_emin_badur.py @@ -0,0 +1,2 @@ +student_id = "210316031" +full_name = "Emin Badur" diff --git a/Week02/types_emin_badur.py b/Week02/types_emin_badur.py new file mode 100644 index 00000000..37e482da --- /dev/null +++ b/Week02/types_emin_badur.py @@ -0,0 +1,4 @@ +my_int = 9 +my_float = 30.08 +my_bool = True +my_complex = 53j diff --git a/Week03/pyramid_emin_badur.py b/Week03/pyramid_emin_badur.py new file mode 100644 index 00000000..89ced23c --- /dev/null +++ b/Week03/pyramid_emin_badur.py @@ -0,0 +1,11 @@ +def calculate_pyramid_height(number_of_blocks): + height = 1 + + if number_of_blocks <= 0 : + raise ValueError("Number of blocks must be positive ") + + while number_of_blocks > height + 1 : + height += 1 + number_of_blocks -= height + + return height diff --git a/Week03/sequences_emin_badur.py b/Week03/sequences_emin_badur.py new file mode 100644 index 00000000..a599670f --- /dev/null +++ b/Week03/sequences_emin_badur.py @@ -0,0 +1,24 @@ +def remove_duplicates(seq: list) -> list : + #This function remove duplicates from list. But we could use the set method to same purpose too. + current_index = 0 + while current_index < len(seq) - 1 : + if seq[current_index] == seq[current_index + 1]: + del seq[current_index + 1] + else : + current_index += 1 + return seq + +def list_counts(seq: list) -> dict: + return {item: seq.count(item) for item in seq} + +def reverse_dict(d: dict) -> dict: + new_dict = {} + for key, value in d.items(): + new_dict[value] = key + return new_dict + + + + + +