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