diff --git a/Week02/types_umut_turk.py b/Week02/types_umut_turk.py new file mode 100644 index 00000000..c3dbf565 --- /dev/null +++ b/Week02/types_umut_turk.py @@ -0,0 +1,4 @@ +my_int = 1312 +my_float = 1157.25 +my_bool = True +my_complex = 4j+8 \ No newline at end of file diff --git a/Week03/pyramid_umut_turk.py b/Week03/pyramid_umut_turk.py new file mode 100644 index 00000000..69b6f3bc --- /dev/null +++ b/Week03/pyramid_umut_turk.py @@ -0,0 +1,11 @@ +def calculate_pyramid_height(b_num): + a, b = 1, 0 + while b < b_num: + b += a+1 + a += 1 + + + return a-1 + +if __name__ == "__main__": + print(calculate_pyramid_height(15)) \ No newline at end of file diff --git a/Week03/sequences_umut_turk.py b/Week03/sequences_umut_turk.py new file mode 100644 index 00000000..ea98b898 --- /dev/null +++ b/Week03/sequences_umut_turk.py @@ -0,0 +1,39 @@ +def remove_duplicates(a_list): + my_list = a_list[:] + for i in a_list: + x = True + for j, k in enumerate(my_list): + if i == k: + if x: + x = False + else: + del my_list[j] + return my_list +def list_counts(a_list): + my_list = a_list[:] + a = remove_duplicates(my_list) + my_dict = dict.fromkeys(a) + for i in a: + x = 0 + for j in a_list: + if i == j: + x += 1 + my_dict[i] = x + + return my_dict +def reverse_dict(a_dict): + my_dict = {} + a_list = list(a_dict) + b_list = list(a_dict.values()) + x = 0 + while x < len(a_list): + print(1) + my_dict[b_list[x]] = a_list[x] + x += 1 + + return my_dict + +if __name__ == "__main__": + print(remove_duplicates([1,5,5,4,4,4,6,6,6,41,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6])) + print(list_counts([1,5,5,4,4,4,6,6,6,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6])) + print(reverse_dict(list_counts([1,5,5,4,4,4,6,6,6,41,41,41,41,41,54,54,54,54,54,54,54,54,41,6]))) \ No newline at end of file