mirror of
https://github.com/onyx-and-iris/grokking-algorithms.git
synced 2025-01-18 00:30:53 +00:00
rename vars
This commit is contained in:
parent
2ad10efb47
commit
73dc3210e5
@ -42,13 +42,13 @@ X = "fosh"
|
||||
Y = "fort"
|
||||
|
||||
logger.info(f"words: {X} {Y}")
|
||||
longest_subsequence = longest_common_subsequence(X, Y, len(X), len(Y))
|
||||
print(f"Longest common subsequence: {longest_subsequence}")
|
||||
length = longest_common_subsequence(X, Y, len(X), len(Y))
|
||||
print(f"Longest common subsequence: {length}")
|
||||
|
||||
|
||||
X = "fosh"
|
||||
Y = "fish"
|
||||
|
||||
logger.info(f"words: {X} {Y}")
|
||||
longest_subsequence = longest_common_subsequence(X, Y, len(X), len(Y))
|
||||
print(f"Longest common subsequence: {longest_subsequence}")
|
||||
length = longest_common_subsequence(X, Y, len(X), len(Y))
|
||||
print(f"Longest common subsequence: {length}")
|
||||
|
@ -45,13 +45,13 @@ X = "fish"
|
||||
Y = "vish"
|
||||
|
||||
logger.info(f"words: {X} {Y}")
|
||||
longest_substring = longest_common_substring(X, Y, len(X), len(Y))
|
||||
print(f"Longest common substring: {longest_substring}")
|
||||
length = longest_common_substring(X, Y, len(X), len(Y))
|
||||
print(f"Longest common substring: {length}")
|
||||
|
||||
|
||||
X = "vista"
|
||||
Y = "hish"
|
||||
|
||||
logger.info(f"words: {X} {Y}")
|
||||
longest_substring = longest_common_substring(X, Y, len(X), len(Y))
|
||||
print(f"Longest common substring: {longest_substring}")
|
||||
length = longest_common_substring(X, Y, len(X), len(Y))
|
||||
print(f"Longest common substring: {length}")
|
||||
|
@ -47,10 +47,10 @@ K = 4
|
||||
|
||||
k_nearest = knn(point, neighbours)
|
||||
|
||||
average_sold = 0
|
||||
total = 0
|
||||
for n in k_nearest:
|
||||
average_sold += n.sold
|
||||
average_sold = average_sold / K
|
||||
total += n.sold
|
||||
average = total / K
|
||||
|
||||
logger.debug(average_sold)
|
||||
print(f"Number of loaves to make: {int(round(average_sold, 0))}")
|
||||
logger.debug(average)
|
||||
print(f"Number of loaves to make: {int(round(average, 0))}")
|
||||
|
Loading…
Reference in New Issue
Block a user