From 753b9274875b41d786769f22e25dd433160f7947 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sat, 4 Feb 2023 22:49:14 +0000 Subject: [PATCH] Fix code style issues with Black --- 3_advanced/chapter17/solutions/min_superset.py | 1 + dsa/chapter1/practice/time_complexity_questions.py | 2 +- dsa/chapter1/solutions/time_complexity.py | 3 ++- dsa/chapter1/solutions/time_complexity_questions.py | 2 +- dsa/chapter3/solutions/selectionsort.py | 2 +- games/chapter1/solution/blackjack.py | 1 - games/chapter3/solutions/SpaceCounter.py | 3 --- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/3_advanced/chapter17/solutions/min_superset.py b/3_advanced/chapter17/solutions/min_superset.py index cce07d80..e7b55ff7 100644 --- a/3_advanced/chapter17/solutions/min_superset.py +++ b/3_advanced/chapter17/solutions/min_superset.py @@ -2,6 +2,7 @@ # of minimum size which is the superset of all the given sets. # Implement the following method: + # superset calcuated using Principle of Inclusion and Exclusion # sets: a vector containing 3 sets def findMinSupersetLength(sets): diff --git a/dsa/chapter1/practice/time_complexity_questions.py b/dsa/chapter1/practice/time_complexity_questions.py index 070a4ba1..f272e328 100644 --- a/dsa/chapter1/practice/time_complexity_questions.py +++ b/dsa/chapter1/practice/time_complexity_questions.py @@ -49,7 +49,7 @@ def example_six(n): # what is the runtime for example 7? def example_seven(n): - for i in range(2 ** n): + for i in range(2**n): do_something() diff --git a/dsa/chapter1/solutions/time_complexity.py b/dsa/chapter1/solutions/time_complexity.py index da8099a1..d006e0f8 100644 --- a/dsa/chapter1/solutions/time_complexity.py +++ b/dsa/chapter1/solutions/time_complexity.py @@ -4,6 +4,7 @@ are examples and not the only ways to have done this problem. """ + # time complexity: O(1) def double_my_number(number): x = number @@ -84,7 +85,7 @@ def get_binary_combinations(number_of_digits): # function with O(2**n) runtime. def regular_o_2_to_the_n(n): operations = 0 - for i in range(2 ** n): + for i in range(2**n): operations += 1 print(f"took {operations} operations") diff --git a/dsa/chapter1/solutions/time_complexity_questions.py b/dsa/chapter1/solutions/time_complexity_questions.py index 79d477b9..96945dc9 100644 --- a/dsa/chapter1/solutions/time_complexity_questions.py +++ b/dsa/chapter1/solutions/time_complexity_questions.py @@ -56,7 +56,7 @@ def example_six(n): # what is the runtime for example 7? # runtime is O(2**n) def example_seven(n): - for i in range(2 ** n): + for i in range(2**n): do_something() diff --git a/dsa/chapter3/solutions/selectionsort.py b/dsa/chapter3/solutions/selectionsort.py index 387bc298..22cb686c 100644 --- a/dsa/chapter3/solutions/selectionsort.py +++ b/dsa/chapter3/solutions/selectionsort.py @@ -16,7 +16,7 @@ def selectionsort(arr: list): for i in range(len(arr)): # Step 2, create an inner loop that iterates from i+1 to the end of the # list, let's name inner index "j" - for j in range(i+1, len(arr)): + for j in range(i + 1, len(arr)): # Step 3, check if the element at index i is larger than the # element at index j if arr[i] > arr[j]: diff --git a/games/chapter1/solution/blackjack.py b/games/chapter1/solution/blackjack.py index 0e88a11f..8cf43ec2 100644 --- a/games/chapter1/solution/blackjack.py +++ b/games/chapter1/solution/blackjack.py @@ -74,7 +74,6 @@ def hit(cards): exit() if sum(dealerList) == 21 and sum(userList) == 21: - print("It is a tie") exit() if sum(dealerList) == 21: diff --git a/games/chapter3/solutions/SpaceCounter.py b/games/chapter3/solutions/SpaceCounter.py index c693844e..bb742f0f 100644 --- a/games/chapter3/solutions/SpaceCounter.py +++ b/games/chapter3/solutions/SpaceCounter.py @@ -13,7 +13,6 @@ run = True while run: - # Render the "display_counter" to the screen show_counter = font.render(str(display_counter), True, (255, 192, 203)) @@ -29,10 +28,8 @@ # Checks to see if key is pressed if event.type == pygame.KEYDOWN: - # Checks to see if the space is pressed if event.key == pygame.K_SPACE: - # Adds one to the counter display_counter += 1