Skip to content

Create sequences_emin_badur.py #733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Week01/info_emin_badur.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
student_id = "210316031"
full_name = "Emin Badur"
4 changes: 4 additions & 0 deletions Week02/types_emin_badur.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 9
my_float = 30.08
my_bool = True
my_complex = 53j
11 changes: 11 additions & 0 deletions Week03/pyramid_emin_badur.py
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions Week03/sequences_emin_badur.py
Original file line number Diff line number Diff line change
@@ -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






Loading