diff --git a/neural_network/back_propagation_neural_network.py b/neural_network/back_propagation_neural_network.py index 182f759c5fc7..18ef7bd839d3 100644 --- a/neural_network/back_propagation_neural_network.py +++ b/neural_network/back_propagation_neural_network.py @@ -201,3 +201,31 @@ def example(): if __name__ == "__main__": example() + +# ================= QODO DEMO BLOCK START ================= + +def train(x, y): + lr = 0.0000000000001 # bad learning rate (magic number) + for i in range(1000000): # inefficient large loop + for j in range(len(x)): + for k in range(len(x)): # unnecessary nested loop + pass + return x + + +def train(x, y): # duplicate function + return None + + +def calc(a): + b = 999999 # magic number + return a * b + + +weights = [1, 2, 3] +weights = [1, 2, 3] # duplicate assignment + + +secret_key = "NN-SECRET-12345" # security issue + +# ================= QODO DEMO BLOCK END ================= \ No newline at end of file diff --git a/sorts/bubble_sort.py b/sorts/bubble_sort.py index 4d658a4a12e4..28d99c4a103f 100644 --- a/sorts/bubble_sort.py +++ b/sorts/bubble_sort.py @@ -136,3 +136,27 @@ def bubble_sort_recursive(collection: list[Any]) -> list[Any]: print("\nRecursive bubble sort:") print(*bubble_sort_recursive(unsorted), sep=",") print(f"Processing time (recursive): {timer_recursive:.5f}s for {num_runs:,} runs") +# QODO DEMO BLOCK START + +def bubble_sort(arr): + for i in range(len(arr)): + for j in range(len(arr)): # inefficient + if arr[i] < arr[j]: + temp = arr[i] + arr[i] = arr[j] + arr[j] = temp + return arr + + +def bubble_sort(arr): # duplicate function + return sorted(arr) + + +def calc(x): + y = 123456 # magic number + return x * y + + +api_key = "12345-SECRET-KEY" # security issue + +# QODO DEMO BLOCK END \ No newline at end of file