File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ student_id = "210316031"
2+ full_name = "Emin Badur"
Original file line number Diff line number Diff line change 1+ my_int = 9
2+ my_float = 30.08
3+ my_bool = True
4+ my_complex = 53j
Original file line number Diff line number Diff line change 1+ def calculate_pyramid_height (number_of_blocks ):
2+ height = 1
3+
4+ if number_of_blocks <= 0 :
5+ raise ValueError ("Number of blocks must be positive " )
6+
7+ while number_of_blocks > height + 1 :
8+ height += 1
9+ number_of_blocks -= height
10+
11+ return height
Original file line number Diff line number Diff line change 1+ def remove_duplicates (seq : list ) -> list :
2+ #This function remove duplicates from list. But we could use the set method to same purpose too.
3+ current_index = 0
4+ while current_index < len (seq ) - 1 :
5+ if seq [current_index ] == seq [current_index + 1 ]:
6+ del seq [current_index + 1 ]
7+ else :
8+ current_index += 1
9+ return seq
10+
11+ def list_counts (seq : list ) -> dict :
12+ return {item : seq .count (item ) for item in seq }
13+
14+ def reverse_dict (d : dict ) -> dict :
15+ new_dict = {}
16+ for key , value in d .items ():
17+ new_dict [value ] = key
18+ return new_dict
19+
20+
21+
22+
23+
24+
You can’t perform that action at this time.
0 commit comments