repo_name
stringclasses
1 value
pr_number
int64
4.12k
11.2k
pr_title
stringlengths
9
107
pr_description
stringlengths
107
5.48k
author
stringlengths
4
18
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
118
5.52k
before_content
stringlengths
0
7.93M
after_content
stringlengths
0
7.93M
label
int64
-1
1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
from typing import Tuple def diophantine(a: int, b: int, c: int) -> Tuple[float, float]: """ Diophantine Equation : Given integers a,b,c ( at least one of a and b != 0), the diophantine equation a*x + b*y = c has a solution (where x and y are integers) iff gcd(a,b) divides c. GCD ( Greatest Commo...
from typing import Tuple def diophantine(a: int, b: int, c: int) -> Tuple[float, float]: """ Diophantine Equation : Given integers a,b,c ( at least one of a and b != 0), the diophantine equation a*x + b*y = c has a solution (where x and y are integers) iff gcd(a,b) divides c. GCD ( Greatest Commo...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 7: https://projecteuler.net/problem=7 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? References: - https://en.wikipedia.org/wiki/Prime_number """ import itertools import math def pri...
""" Project Euler Problem 7: https://projecteuler.net/problem=7 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? References: - https://en.wikipedia.org/wiki/Prime_number """ import itertools import math def pri...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" This is a pure Python implementation of the pancake sort algorithm For doctests run following command: python3 -m doctest -v pancake_sort.py or python -m doctest -v pancake_sort.py For manual testing run: python pancake_sort.py """ def pancake_sort(arr): """Sort Array with Pancake Sort. :param arr: Collec...
""" This is a pure Python implementation of the pancake sort algorithm For doctests run following command: python3 -m doctest -v pancake_sort.py or python -m doctest -v pancake_sort.py For manual testing run: python pancake_sort.py """ def pancake_sort(arr): """Sort Array with Pancake Sort. :param arr: Collec...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
import os UPPERLETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" LETTERS_AND_SPACE = UPPERLETTERS + UPPERLETTERS.lower() + " \t\n" def loadDictionary(): path = os.path.split(os.path.realpath(__file__)) englishWords = {} with open(path[0] + "/dictionary.txt") as dictionaryFile: for word in dictionaryFile.rea...
import os UPPERLETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" LETTERS_AND_SPACE = UPPERLETTERS + UPPERLETTERS.lower() + " \t\n" def loadDictionary(): path = os.path.split(os.path.realpath(__file__)) englishWords = {} with open(path[0] + "/dictionary.txt") as dictionaryFile: for word in dictionaryFile.rea...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
# Title: Dijkstra's Algorithm for finding single source shortest path from scratch # Author: Shubham Malik # References: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm import math import sys # For storing the vertex set to retrieve node with the lowest distance class PriorityQueue: # Based on Min Heap ...
# Title: Dijkstra's Algorithm for finding single source shortest path from scratch # Author: Shubham Malik # References: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm import math import sys # For storing the vertex set to retrieve node with the lowest distance class PriorityQueue: # Based on Min Heap ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" This script demonstrates the implementation of the Sigmoid function. The function takes a vector of K real numbers as input and then 1 / (1 + exp(-x)). After through Sigmoid, the element of the vector mostly 0 between 1. or 1 between -1. Script inspired from its corresponding Wikipedia article https://en.wikipedi...
""" This script demonstrates the implementation of the Sigmoid function. The function takes a vector of K real numbers as input and then 1 / (1 + exp(-x)). After through Sigmoid, the element of the vector mostly 0 between 1. or 1 between -1. Script inspired from its corresponding Wikipedia article https://en.wikipedi...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Problem 16: https://projecteuler.net/problem=16 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? """ def solution(power: int = 1000) -> int: """Returns the sum of the digits of the number 2^power. >>> solution(1000) 1366 >>> s...
""" Problem 16: https://projecteuler.net/problem=16 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? """ def solution(power: int = 1000) -> int: """Returns the sum of the digits of the number 2^power. >>> solution(1000) 1366 >>> s...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
# Implementing Newton Raphson method in Python # Author: Syed Haseeb Shah (github.com/QuantumNovice) # The Newton-Raphson method (also known as Newton's method) is a way to # quickly find a good approximation for the root of a real-valued function from decimal import Decimal from math import * # noqa: F401, F403 from ...
# Implementing Newton Raphson method in Python # Author: Syed Haseeb Shah (github.com/QuantumNovice) # The Newton-Raphson method (also known as Newton's method) is a way to # quickly find a good approximation for the root of a real-valued function from decimal import Decimal from math import * # noqa: F401, F403 from ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Finding the peak of a unimodal list using divide and conquer. A unimodal array is defined as follows: array is increasing up to index p, then decreasing afterwards. (for p >= 1) An obvious solution can be performed in O(n), to find the maximum of the array. (From Kleinberg and Tardos. Algorithm Design. Addison Wesl...
""" Finding the peak of a unimodal list using divide and conquer. A unimodal array is defined as follows: array is increasing up to index p, then decreasing afterwards. (for p >= 1) An obvious solution can be performed in O(n), to find the maximum of the array. (From Kleinberg and Tardos. Algorithm Design. Addison Wesl...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" https://en.wikipedia.org/wiki/Infix_notation https://en.wikipedia.org/wiki/Reverse_Polish_notation https://en.wikipedia.org/wiki/Shunting-yard_algorithm """ from .balanced_parentheses import balanced_parentheses from .stack import Stack def precedence(char: str) -> int: """ Return integer value represent...
""" https://en.wikipedia.org/wiki/Infix_notation https://en.wikipedia.org/wiki/Reverse_Polish_notation https://en.wikipedia.org/wiki/Shunting-yard_algorithm """ from .balanced_parentheses import balanced_parentheses from .stack import Stack def precedence(char: str) -> int: """ Return integer value represent...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
def oct_to_decimal(oct_string: str) -> int: """ Convert a octal value to its decimal equivalent >>> oct_to_decimal("12") 10 >>> oct_to_decimal(" 12 ") 10 >>> oct_to_decimal("-45") -37 >>> oct_to_decimal("2-0Fm") Traceback (most recent call last): ... ValueError: Non-oc...
def oct_to_decimal(oct_string: str) -> int: """ Convert a octal value to its decimal equivalent >>> oct_to_decimal("12") 10 >>> oct_to_decimal(" 12 ") 10 >>> oct_to_decimal("-45") -37 >>> oct_to_decimal("2-0Fm") Traceback (most recent call last): ... ValueError: Non-oc...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Problem 123: https://projecteuler.net/problem=123 Name: Prime square remainders Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and let r be the remainder when (pn−1)^n + (pn+1)^n is divided by pn^2. For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25. The least value of n for which the remainder first e...
""" Problem 123: https://projecteuler.net/problem=123 Name: Prime square remainders Let pn be the nth prime: 2, 3, 5, 7, 11, ..., and let r be the remainder when (pn−1)^n + (pn+1)^n is divided by pn^2. For example, when n = 3, p3 = 5, and 43 + 63 = 280 ≡ 5 mod 25. The least value of n for which the remainder first e...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Functions for 2D matrix operations """ from __future__ import annotations def add(*matrix_s: list[list]) -> list[list]: """ >>> add([[1,2],[3,4]],[[2,3],[4,5]]) [[3, 5], [7, 9]] >>> add([[1.2,2.4],[3,4]],[[2,3],[4,5]]) [[3.2, 5.4], [7, 9]] >>> add([[1, 2], [4, 5]], [[3, 7], [3, 4]], [[3, ...
""" Functions for 2D matrix operations """ from __future__ import annotations def add(*matrix_s: list[list]) -> list[list]: """ >>> add([[1,2],[3,4]],[[2,3],[4,5]]) [[3, 5], [7, 9]] >>> add([[1.2,2.4],[3,4]],[[2,3],[4,5]]) [[3.2, 5.4], [7, 9]] >>> add([[1, 2], [4, 5]], [[3, 7], [3, 4]], [[3, ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 301: https://projecteuler.net/problem=301 Problem Statement: Nim is a game played with heaps of stones, where two players take it in turn to remove any number of stones from any heap until no stones remain. We'll consider the three-heap normal-play version of Nim, which works as follows: - A...
""" Project Euler Problem 301: https://projecteuler.net/problem=301 Problem Statement: Nim is a game played with heaps of stones, where two players take it in turn to remove any number of stones from any heap until no stones remain. We'll consider the three-heap normal-play version of Nim, which works as follows: - A...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
from typing import List """ A naive recursive implementation of 0-1 Knapsack Problem https://en.wikipedia.org/wiki/Knapsack_problem """ def knapsack(capacity: int, weights: List[int], values: List[int], counter: int) -> int: """ Returns the maximum value that can be put in a knapsack of a capacity cap, ...
from typing import List """ A naive recursive implementation of 0-1 Knapsack Problem https://en.wikipedia.org/wiki/Knapsack_problem """ def knapsack(capacity: int, weights: List[int], values: List[int], counter: int) -> int: """ Returns the maximum value that can be put in a knapsack of a capacity cap, ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" In a multi-threaded download, this algorithm could be used to provide each worker thread with a block of non-overlapping bytes to download. For example: for i in allocation_list: requests.get(url,headers={'Range':f'bytes={i}'}) """ from __future__ import annotations def allocation_num(number_of_bytes:...
""" In a multi-threaded download, this algorithm could be used to provide each worker thread with a block of non-overlapping bytes to download. For example: for i in allocation_list: requests.get(url,headers={'Range':f'bytes={i}'}) """ from __future__ import annotations def allocation_num(number_of_bytes:...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Coin sums Problem 31: https://projecteuler.net/problem=31 In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p H...
""" Coin sums Problem 31: https://projecteuler.net/problem=31 In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation: 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). It is possible to make £2 in the following way: 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p H...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Round Robin is a scheduling algorithm. In Round Robin each process is assigned a fixed time slot in a cyclic way. https://en.wikipedia.org/wiki/Round-robin_scheduling """ from statistics import mean from typing import List def calculate_waiting_times(burst_times: List[int]) -> List[int]: """ Calculate the...
""" Round Robin is a scheduling algorithm. In Round Robin each process is assigned a fixed time slot in a cyclic way. https://en.wikipedia.org/wiki/Round-robin_scheduling """ from statistics import mean from typing import List def calculate_waiting_times(burst_times: List[int]) -> List[int]: """ Calculate the...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
from decimal import Decimal, getcontext from math import ceil, factorial def pi(precision: int) -> str: """ The Chudnovsky algorithm is a fast method for calculating the digits of PI, based on Ramanujan’s PI formulae. https://en.wikipedia.org/wiki/Chudnovsky_algorithm PI = constant_term / ((mult...
from decimal import Decimal, getcontext from math import ceil, factorial def pi(precision: int) -> str: """ The Chudnovsky algorithm is a fast method for calculating the digits of PI, based on Ramanujan’s PI formulae. https://en.wikipedia.org/wiki/Chudnovsky_algorithm PI = constant_term / ((mult...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" A Python implementation of the quick select algorithm, which is efficient for calculating the value that would appear in the index of a list if it would be sorted, even if it is not already sorted https://en.wikipedia.org/wiki/Quickselect """ import random def _partition(data: list, pivot) -> tuple: """ T...
""" A Python implementation of the quick select algorithm, which is efficient for calculating the value that would appear in the index of a list if it would be sorted, even if it is not already sorted https://en.wikipedia.org/wiki/Quickselect """ import random def _partition(data: list, pivot) -> tuple: """ T...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Lychrel numbers Problem 55: https://projecteuler.net/problem=55 If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, 349 + 943 = 1292, 1292 + 2921 = 4213 4213 + 3124 = 7337 That is, 349 took three iterations to arrive at a palindrome. A...
""" Lychrel numbers Problem 55: https://projecteuler.net/problem=55 If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, 349 + 943 = 1292, 1292 + 2921 = 4213 4213 + 3124 = 7337 That is, 349 took three iterations to arrive at a palindrome. A...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" https://cp-algorithms.com/string/prefix-function.html Prefix function Knuth–Morris–Pratt algorithm Different algorithm than Knuth-Morris-Pratt pattern finding E.x. Finding longest prefix which is also suffix Time Complexity: O(n) - where n is the length of the string """ def prefix_function(input_string: str)...
""" https://cp-algorithms.com/string/prefix-function.html Prefix function Knuth–Morris–Pratt algorithm Different algorithm than Knuth-Morris-Pratt pattern finding E.x. Finding longest prefix which is also suffix Time Complexity: O(n) - where n is the length of the string """ def prefix_function(input_string: str)...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 10: https://projecteuler.net/problem=10 Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. References: - https://en.wikipedia.org/wiki/Prime_number """ from math import sqrt def is_prime(n: int) -> bool: ""...
""" Project Euler Problem 10: https://projecteuler.net/problem=10 Summation of primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. References: - https://en.wikipedia.org/wiki/Prime_number """ from math import sqrt def is_prime(n: int) -> bool: ""...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Conversion of weight units. __author__ = "Anubhav Solanki" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Anubhav Solanki" __email__ = "anubhavsolanki0@gmail.com" USAGE : -> Import this file into their respective project. -> Use the function weight_conversion() for conversion of weight units. -> Para...
""" Conversion of weight units. __author__ = "Anubhav Solanki" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Anubhav Solanki" __email__ = "anubhavsolanki0@gmail.com" USAGE : -> Import this file into their respective project. -> Use the function weight_conversion() for conversion of weight units. -> Para...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
class Node: def __init__(self, data): self.data = data self.next = None def __repr__(self): return f"Node({self.data})" class LinkedList: def __init__(self): self.head = None def __iter__(self): node = self.head while node: yield node.data ...
class Node: def __init__(self, data): self.data = data self.next = None def __repr__(self): return f"Node({self.data})" class LinkedList: def __init__(self): self.head = None def __iter__(self): node = self.head while node: yield node.data ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
"""Prime Check.""" import math import unittest def prime_check(number: int) -> bool: """Checks to see if a number is a prime. A number is prime if it has exactly two factors: 1 and itself. """ if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not number % 2:...
"""Prime Check.""" import math import unittest def prime_check(number: int) -> bool: """Checks to see if a number is a prime. A number is prime if it has exactly two factors: 1 and itself. """ if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or not number % 2:...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 80: https://projecteuler.net/problem=80 Author: Sandeep Gupta Problem statement: For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots. Time: 5 October 2020, 18:30 """ import decimal def solut...
""" Project Euler Problem 80: https://projecteuler.net/problem=80 Author: Sandeep Gupta Problem statement: For the first one hundred natural numbers, find the total of the digital sums of the first one hundred decimal digits for all the irrational square roots. Time: 5 October 2020, 18:30 """ import decimal def solut...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
# The Algorithms - Python [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/TheAlgorithms/Python)&nbsp; [![Gitter chat](https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square)](htt...
# The Algorithms - Python [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/TheAlgorithms/Python)&nbsp; [![Gitter chat](https://img.shields.io/badge/Chat-Gitter-ff69b4.svg?label=Chat&logo=gitter&style=flat-square)](htt...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Consider all integer combinations of ab for 2 <= a <= 5 and 2 <= b <= 5: 2^2=4, 2^3=8, 2^4=16, 2^5=32 3^2=9, 3^3=27, 3^4=81, 3^5=243 4^2=16, 4^3=64, 4^4=256, 4^5=1024 5^2=25, 5^3=125, 5^4=625, 5^5=3125 If they are then placed in numerical order, with any repeats removed, we get the following sequence of 1...
""" Consider all integer combinations of ab for 2 <= a <= 5 and 2 <= b <= 5: 2^2=4, 2^3=8, 2^4=16, 2^5=32 3^2=9, 3^3=27, 3^4=81, 3^5=243 4^2=16, 4^3=64, 4^4=256, 4^5=1024 5^2=25, 5^3=125, 5^4=625, 5^5=3125 If they are then placed in numerical order, with any repeats removed, we get the following sequence of 1...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Implementation Burke's algorithm (dithering) """ import numpy as np from cv2 import destroyAllWindows, imread, imshow, waitKey class Burkes: """ Burke's algorithm is using for converting grayscale image to black and white version Source: Source: https://en.wikipedia.org/wiki/Dither Note: ...
""" Implementation Burke's algorithm (dithering) """ import numpy as np from cv2 import destroyAllWindows, imread, imshow, waitKey class Burkes: """ Burke's algorithm is using for converting grayscale image to black and white version Source: Source: https://en.wikipedia.org/wiki/Dither Note: ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Prize Strings Problem 191 A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize. During an n-day period a trinary string is formed for each child consisting of L's (lat...
""" Prize Strings Problem 191 A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize. During an n-day period a trinary string is formed for each child consisting of L's (lat...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
Unnamed repository; edit this file 'description' to name the repository.
Unnamed repository; edit this file 'description' to name the repository.
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def translate_message(key, message, mode): """ >>> translate_message("QWERTYUIOPASDFGHJKLZXCVBNM","Hello World","encrypt") 'Pcssi Bidsm' """ chars_a = LETTERS if mode == "decrypt" else key chars_b = key if mode == "decrypt" else LETTERS translated = "...
LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" def translate_message(key, message, mode): """ >>> translate_message("QWERTYUIOPASDFGHJKLZXCVBNM","Hello World","encrypt") 'Pcssi Bidsm' """ chars_a = LETTERS if mode == "decrypt" else key chars_b = key if mode == "decrypt" else LETTERS translated = "...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" A Queue using a linked list like structure """ from typing import Any class Node: def __init__(self, data: Any) -> None: self.data = data self.next = None def __str__(self) -> str: return f"{self.data}" class LinkedQueue: """ >>> queue = LinkedQueue() >>> queue.is_em...
""" A Queue using a linked list like structure """ from typing import Any class Node: def __init__(self, data: Any) -> None: self.data = data self.next = None def __str__(self) -> str: return f"{self.data}" class LinkedQueue: """ >>> queue = LinkedQueue() >>> queue.is_em...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 5: https://projecteuler.net/problem=5 Smallest multiple 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is _evenly divisible_ by all of the numbers from 1 to 20? References: - https://e...
""" Project Euler Problem 5: https://projecteuler.net/problem=5 Smallest multiple 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is _evenly divisible_ by all of the numbers from 1 to 20? References: - https://e...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
#!/usr/bin/env python # # Sort large text files in a minimum amount of memory # import argparse import os class FileSplitter: BLOCK_FILENAME_FORMAT = "block_{0}.dat" def __init__(self, filename): self.filename = filename self.block_filenames = [] def write_block(self, data, block_number...
#!/usr/bin/env python # # Sort large text files in a minimum amount of memory # import argparse import os class FileSplitter: BLOCK_FILENAME_FORMAT = "block_{0}.dat" def __init__(self, filename): self.filename = filename self.block_filenames = [] def write_block(self, data, block_number...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Pure Python implementations of a Fixed Priority Queue and an Element Priority Queue using Python lists. """ class OverFlowError(Exception): pass class UnderFlowError(Exception): pass class FixedPriorityQueue: """ Tasks can be added to a Priority Queue at any time and in any order but when Task...
""" Pure Python implementations of a Fixed Priority Queue and an Element Priority Queue using Python lists. """ class OverFlowError(Exception): pass class UnderFlowError(Exception): pass class FixedPriorityQueue: """ Tasks can be added to a Priority Queue at any time and in any order but when Task...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Multiply two numbers using Karatsuba algorithm """ def karatsuba(a, b): """ >>> karatsuba(15463, 23489) == 15463 * 23489 True >>> karatsuba(3, 9) == 3 * 9 True """ if len(str(a)) == 1 or len(str(b)) == 1: return a * b else: m1 = max(len(str(a)), len(str(b))) ...
""" Multiply two numbers using Karatsuba algorithm """ def karatsuba(a, b): """ >>> karatsuba(15463, 23489) == 15463 * 23489 True >>> karatsuba(3, 9) == 3 * 9 True """ if len(str(a)) == 1 or len(str(b)) == 1: return a * b else: m1 = max(len(str(a)), len(str(b))) ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
# Author: João Gustavo A. Amorim & Gabriel Kunz # Author email: joaogustavoamorim@gmail.com and gabriel-kunz@uergs.edu.br # Coding date: apr 2019 # Black: True """ * This code implement the Hamming code: https://en.wikipedia.org/wiki/Hamming_code - In telecommunication, Hamming codes are a family of l...
# Author: João Gustavo A. Amorim & Gabriel Kunz # Author email: joaogustavoamorim@gmail.com and gabriel-kunz@uergs.edu.br # Coding date: apr 2019 # Black: True """ * This code implement the Hamming code: https://en.wikipedia.org/wiki/Hamming_code - In telecommunication, Hamming codes are a family of l...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Linked Lists consists of Nodes. Nodes contain data and also may link to other nodes: - Head Node: First node, the address of the head node gives us access of the complete list - Last node: points to null """ from typing import Any class Node: def __init__(self, item: Any, next: Any) ...
""" Linked Lists consists of Nodes. Nodes contain data and also may link to other nodes: - Head Node: First node, the address of the head node gives us access of the complete list - Last node: points to null """ from typing import Any class Node: def __init__(self, item: Any, next: Any) ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" An Armstrong number is equal to the sum of the cubes of its digits. For example, 370 is an Armstrong number because 3*3*3 + 7*7*7 + 0*0*0 = 370. An Armstrong number is often called Narcissistic number. """ def armstrong_number(n: int) -> bool: """ Return True if n is an Armstrong number or False if it is ...
""" An Armstrong number is equal to the sum of the cubes of its digits. For example, 370 is an Armstrong number because 3*3*3 + 7*7*7 + 0*0*0 = 370. An Armstrong number is often called Narcissistic number. """ def armstrong_number(n: int) -> bool: """ Return True if n is an Armstrong number or False if it is ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" == Perfect Number == In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For example: 6 ==> divisors[1, 2, 3, 6] Excluding 6, the sum(divisors) is 1 + 2 + 3 = 6 So, 6 is a Perfect Number Other examples of Perfect Numbers: ...
""" == Perfect Number == In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For example: 6 ==> divisors[1, 2, 3, 6] Excluding 6, the sum(divisors) is 1 + 2 + 3 = 6 So, 6 is a Perfect Number Other examples of Perfect Numbers: ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
#!/usr/bin/env python3 # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from pprint import pformat class GraphAdjacencyList: """ Adjacency List type Graph Data Structure that accounts for directed and undirected Graphs. Initialize graph object indicating w...
#!/usr/bin/env python3 # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from pprint import pformat class GraphAdjacencyList: """ Adjacency List type Graph Data Structure that accounts for directed and undirected Graphs. Initialize graph object indicating w...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
"""Get the site emails from URL.""" __author__ = "Muhammad Umer Farooq" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Muhammad Umer Farooq" __email__ = "contact@muhammadumerfarooq.me" __status__ = "Alpha" import re from html.parser import HTMLParser from urllib import parse import requests class Parse...
"""Get the site emails from URL.""" __author__ = "Muhammad Umer Farooq" __license__ = "MIT" __version__ = "1.0.0" __maintainer__ = "Muhammad Umer Farooq" __email__ = "contact@muhammadumerfarooq.me" __status__ = "Alpha" import re from html.parser import HTMLParser from urllib import parse import requests class Parse...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
import os from itertools import chain from random import randrange, shuffle import pytest from .sol1 import PokerHand SORTED_HANDS = ( "4S 3H 2C 7S 5H", "9D 8H 2C 6S 7H", "2D 6D 9D TH 7D", "TC 8C 2S JH 6C", "JH 8S TH AH QH", "TS KS 5S 9S AC", "KD 6S 9D TH AD", "KS 8D 4D 9S 4S", # pai...
import os from itertools import chain from random import randrange, shuffle import pytest from .sol1 import PokerHand SORTED_HANDS = ( "4S 3H 2C 7S 5H", "9D 8H 2C 6S 7H", "2D 6D 9D TH 7D", "TC 8C 2S JH 6C", "JH 8S TH AH QH", "TS KS 5S 9S AC", "KD 6S 9D TH AD", "KS 8D 4D 9S 4S", # pai...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 1: https://projecteuler.net/problem=1 Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n: int = 1000) -> int: ...
""" Project Euler Problem 1: https://projecteuler.net/problem=1 Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ def solution(n: int = 1000) -> int: ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
#
#
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Convert International System of Units (SI) and Binary prefixes """ from enum import Enum from typing import Union class SI_Unit(Enum): yotta = 24 zetta = 21 exa = 18 peta = 15 tera = 12 giga = 9 mega = 6 kilo = 3 hecto = 2 deca = 1 deci = -1 centi = -2 milli = -...
""" Convert International System of Units (SI) and Binary prefixes """ from enum import Enum from typing import Union class SI_Unit(Enum): yotta = 24 zetta = 21 exa = 18 peta = 15 tera = 12 giga = 9 mega = 6 kilo = 3 hecto = 2 deca = 1 deci = -1 centi = -2 milli = -...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
def median(nums): """ Find median of a list of numbers. >>> median([0]) 0 >>> median([4,1,3,2]) 2.5 >>> median([2, 70, 6, 50, 20, 8, 4]) 8 Args: nums: List of nums Returns: Median. """ sorted_list = sorted(nums) length = len(sorted_list) mid_ind...
def median(nums): """ Find median of a list of numbers. >>> median([0]) 0 >>> median([4,1,3,2]) 2.5 >>> median([2, 70, 6, 50, 20, 8, 4]) 8 Args: nums: List of nums Returns: Median. """ sorted_list = sorted(nums) length = len(sorted_list) mid_ind...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power. How many n-digit positive integers exist which are also an nth power? """ """ The maximum base can be 9 because all n-digit numbers < 10^n. Now 9**23 has 22 digits so the maximum power can be 22. Usi...
""" The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power. How many n-digit positive integers exist which are also an nth power? """ """ The maximum base can be 9 because all n-digit numbers < 10^n. Now 9**23 has 22 digits so the maximum power can be 22. Usi...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
from math import log2 def binary_count_trailing_zeros(a: int) -> int: """ Take in 1 integer, return a number that is the number of trailing zeros in binary representation of that number. >>> binary_count_trailing_zeros(25) 0 >>> binary_count_trailing_zeros(36) 2 >>> binary_count_trail...
from math import log2 def binary_count_trailing_zeros(a: int) -> int: """ Take in 1 integer, return a number that is the number of trailing zeros in binary representation of that number. >>> binary_count_trailing_zeros(25) 0 >>> binary_count_trailing_zeros(36) 2 >>> binary_count_trail...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Linear regression is the most basic type of regression commonly used for predictive analysis. The idea is pretty simple: we have a dataset and we have features associated with it. Features should be chosen very cautiously as they determine how much our model will be able to make future predictions. We try to set th...
""" Linear regression is the most basic type of regression commonly used for predictive analysis. The idea is pretty simple: we have a dataset and we have features associated with it. Features should be chosen very cautiously as they determine how much our model will be able to make future predictions. We try to set th...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter). Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.[2] source: h...
""" Adler-32 is a checksum algorithm which was invented by Mark Adler in 1995. Compared to a cyclic redundancy check of the same length, it trades reliability for speed (preferring the latter). Adler-32 is more reliable than Fletcher-16, and slightly less reliable than Fletcher-32.[2] source: h...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
9caf4784aada17dc75348f77cc8c356df503c0f3
9caf4784aada17dc75348f77cc8c356df503c0f3
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-,-,-,427,668,495,377,678,-,177,-,-,870,-,869,624,300,609,131,-,251,-,-,-,856,221,514,-,591,762,182,56,-,884,412,273,636,-,-,774 -,-,262,-,-,508,472,799,-,956,578,363,940,143,-,162,122,910,-,729,802,941,922,573,531,539,667,607,-,920,-,-,315,649,937,-,185,102,636,289 -,262,-,-,926,-,958,158,647,47,621,264,81,-,402,813,6...
-,-,-,427,668,495,377,678,-,177,-,-,870,-,869,624,300,609,131,-,251,-,-,-,856,221,514,-,591,762,182,56,-,884,412,273,636,-,-,774 -,-,262,-,-,508,472,799,-,956,578,363,940,143,-,162,122,910,-,729,802,941,922,573,531,539,667,607,-,920,-,-,315,649,937,-,185,102,636,289 -,262,-,-,926,-,958,158,647,47,621,264,81,-,402,813,6...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" This is a pure Python implementation of the bogosort algorithm, also known as permutation sort, stupid sort, slowsort, shotgun sort, or monkey sort. Bogosort generates random permutations until it guesses the correct one. More info on: https://en.wikipedia.org/wiki/Bogosort For doctests run following command: pyt...
""" This is a pure Python implementation of the bogosort algorithm, also known as permutation sort, stupid sort, slowsort, shotgun sort, or monkey sort. Bogosort generates random permutations until it guesses the correct one. More info on: https://en.wikipedia.org/wiki/Bogosort For doctests run following command: pyt...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" This is pure Python implementation of comb sort algorithm. Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz Dobosiewicz in 1980. It was rediscovered by Stephen Lacey and Richard Box in 1991. Comb sort improves on bubble sort algorithm. In bubble sort, distance (or gap) between ...
""" This is pure Python implementation of comb sort algorithm. Comb sort is a relatively simple sorting algorithm originally designed by Wlodzimierz Dobosiewicz in 1980. It was rediscovered by Stephen Lacey and Richard Box in 1991. Comb sort improves on bubble sort algorithm. In bubble sort, distance (or gap) between ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Approximates the area under the curve using the trapezoidal rule """ from typing import Callable, Union def trapezoidal_area( fnc: Callable[[Union[int, float]], Union[int, float]], x_start: Union[int, float], x_end: Union[int, float], steps: int = 100, ) -> float: """ Treats curve as a co...
""" Approximates the area under the curve using the trapezoidal rule """ from typing import Callable, Union def trapezoidal_area( fnc: Callable[[Union[int, float]], Union[int, float]], x_start: Union[int, float], x_end: Union[int, float], steps: int = 100, ) -> float: """ Treats curve as a co...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
from sklearn import svm from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split # different functions implementing different types of SVM's def NuSVC(train_x, train_y): svc_NuSVC = svm.NuSVC() svc_NuSVC.fit(train_x, train_y) return svc_NuSVC def Linearsvc(train_x, tra...
from sklearn import svm from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split # different functions implementing different types of SVM's def NuSVC(train_x, train_y): svc_NuSVC = svm.NuSVC() svc_NuSVC.fit(train_x, train_y) return svc_NuSVC def Linearsvc(train_x, tra...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" This is a pure Python implementation of the P-Series algorithm https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#P-series For doctests run following command: python -m doctest -v p_series.py or python3 -m doctest -v p_series.py For manual testing run: python3 p_series.py """ def p_series(nth_term: int...
""" This is a pure Python implementation of the P-Series algorithm https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#P-series For doctests run following command: python -m doctest -v p_series.py or python3 -m doctest -v p_series.py For manual testing run: python3 p_series.py """ def p_series(nth_term: int...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Self Powers Problem 48 The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. """ def solution(): """ Returns the last 10 digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. >>> solution() '9110846700' """ ...
""" Self Powers Problem 48 The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. """ def solution(): """ Returns the last 10 digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000. >>> solution() '9110846700' """ ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
# https://en.wikipedia.org/wiki/Ohm%27s_law def ohms_law(voltage: float, current: float, resistance: float) -> float: """ Apply Ohm's Law, on any two given electrical values, which can be voltage, current, and resistance, and then in a Python dict return name/value pair of the zero value. >>> ohms_la...
# https://en.wikipedia.org/wiki/Ohm%27s_law def ohms_law(voltage: float, current: float, resistance: float) -> float: """ Apply Ohm's Law, on any two given electrical values, which can be voltage, current, and resistance, and then in a Python dict return name/value pair of the zero value. >>> ohms_la...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Linear Discriminant Analysis Assumptions About Data : 1. The input variables has a gaussian distribution. 2. The variance calculated for each input variables by class grouping is the same. 3. The mix of classes in your training set is representative of the problem. ...
""" Linear Discriminant Analysis Assumptions About Data : 1. The input variables has a gaussian distribution. 2. The variance calculated for each input variables by class grouping is the same. 3. The mix of classes in your training set is representative of the problem. ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 35 https://projecteuler.net/problem=35 Problem Statement: The number 197 is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular pr...
""" Project Euler Problem 35 https://projecteuler.net/problem=35 Problem Statement: The number 197 is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular pr...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
def binary_search(lst, item, start, end): if start == end: return start if lst[start] > item else start + 1 if start > end: return start mid = (start + end) // 2 if lst[mid] < item: return binary_search(lst, item, mid + 1, end) elif lst[mid] > item: return binary_sea...
def binary_search(lst, item, start, end): if start == end: return start if lst[start] > item else start + 1 if start > end: return start mid = (start + end) // 2 if lst[mid] < item: return binary_search(lst, item, mid + 1, end) elif lst[mid] > item: return binary_sea...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Number letter counts Problem 17: https://projecteuler.net/problem=17 If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters woul...
""" Number letter counts Problem 17: https://projecteuler.net/problem=17 If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters woul...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Isolate the Decimal part of a Number https://stackoverflow.com/questions/3886402/how-to-get-numbers-after-decimal-point """ def decimal_isolate(number, digitAmount): """ Isolates the decimal part of a number. If digitAmount > 0 round to that decimal place, else print the entire decimal. >>> decim...
""" Isolate the Decimal part of a Number https://stackoverflow.com/questions/3886402/how-to-get-numbers-after-decimal-point """ def decimal_isolate(number, digitAmount): """ Isolates the decimal part of a number. If digitAmount > 0 round to that decimal place, else print the entire decimal. >>> decim...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" Project Euler Problem 113: https://projecteuler.net/problem=113 Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468. Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420. We ...
""" Project Euler Problem 113: https://projecteuler.net/problem=113 Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468. Similarly if no digit is exceeded by the digit to its right it is called a decreasing number; for example, 66420. We ...
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
0000000000000000000000000000000000000000 9caf4784aada17dc75348f77cc8c356df503c0f3 jupyter <jupyter@data-collection2-susnato.c.rishabh-experiments.internal> 1704811012 +0000 clone: from https://github.com/TheAlgorithms/Python.git
0000000000000000000000000000000000000000 9caf4784aada17dc75348f77cc8c356df503c0f3 jupyter <jupyter@data-collection2-susnato.c.rishabh-experiments.internal> 1704811012 +0000 clone: from https://github.com/TheAlgorithms/Python.git
-1
TheAlgorithms/Python
4,118
Changes occurences of str.format to f-strings
### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md). * [x] This pull request is all my own...
CarsonHam
2021-01-13T04:57:54Z
2021-02-23T05:53:49Z
f680806894d39265f810e7257d50aa0beaf2152e
61f3119467584de53a2f4395e3c03a8e12d67d30
Changes occurences of str.format to f-strings. ### **Describe your change:** fixes: #4117 * [ ] Add an algorithm? * [x] Fix a bug or typo in an existing algorithm? * [ ] Documentation change? ### **Checklist:** * [x] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUT...
""" wiki: https://en.wikipedia.org/wiki/Anagram """ def check_anagrams(first_str: str, second_str: str) -> bool: """ Two strings are anagrams if they are made of the same letters arranged differently (ignoring the case). >>> check_anagrams('Silent', 'Listen') True >>> check_anagrams('This is a...
""" wiki: https://en.wikipedia.org/wiki/Anagram """ def check_anagrams(first_str: str, second_str: str) -> bool: """ Two strings are anagrams if they are made of the same letters arranged differently (ignoring the case). >>> check_anagrams('Silent', 'Listen') True >>> check_anagrams('This is a...
-1