mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
Deal with maps (#1945)
* Deal with maps Try with the search term "pizza" to see why this was done in #1932 * fixup! Format Python code with psf/black push * Update armstrong_numbers.py * updating DIRECTORY.md * Update crawl_google_results.py Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
parent
1e84aabaea
commit
08c8bb5ad5
|
@ -15,6 +15,7 @@
|
|||
* [All Permutations](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_permutations.py)
|
||||
* [All Subsequences](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_subsequences.py)
|
||||
* [Coloring](https://github.com/TheAlgorithms/Python/blob/master/backtracking/coloring.py)
|
||||
* [Hamiltonian Cycle](https://github.com/TheAlgorithms/Python/blob/master/backtracking/hamiltonian_cycle.py)
|
||||
* [Minimax](https://github.com/TheAlgorithms/Python/blob/master/backtracking/minimax.py)
|
||||
* [N Queens](https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens.py)
|
||||
* [Sudoku](https://github.com/TheAlgorithms/Python/blob/master/backtracking/sudoku.py)
|
||||
|
@ -89,6 +90,7 @@
|
|||
* [Number Of Possible Binary Trees](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/number_of_possible_binary_trees.py)
|
||||
* [Red Black Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/red_black_tree.py)
|
||||
* [Segment Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/segment_tree.py)
|
||||
* [Segment Tree Other](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/segment_tree_other.py)
|
||||
* [Treap](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/treap.py)
|
||||
* Data Structures
|
||||
* Heap
|
||||
|
@ -499,6 +501,8 @@
|
|||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol1.py)
|
||||
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol2.py)
|
||||
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol3.py)
|
||||
* Problem 26
|
||||
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_26/sol1.py)
|
||||
* Problem 27
|
||||
* [Problem 27 Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_27/problem_27_sol1.py)
|
||||
* Problem 28
|
||||
|
|
|
@ -41,15 +41,18 @@ def armstrong_number(n: int) -> bool:
|
|||
temp //= 10
|
||||
return n == sum
|
||||
|
||||
def narcissistic_number(n:int) -> bool:
|
||||
|
||||
def narcissistic_number(n: int) -> bool:
|
||||
"""Return True if n is a narcissistic number or False if it is not"""
|
||||
|
||||
expo = len(str(n)) #power, all number will be raised to
|
||||
temp = [(int(i)**expo) for i in str(n)] # each digit will be multiplied expo times
|
||||
|
||||
# check if sum of cube of each digit is equal to number
|
||||
|
||||
expo = len(str(n)) # power, all number will be raised to
|
||||
# each digit will be multiplied expo times
|
||||
temp = [(int(i) ** expo) for i in str(n)]
|
||||
|
||||
# check if sum of cube of each digit is equal to number
|
||||
return n == sum(temp)
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Request that user input an integer and tell them if it is Armstrong number.
|
||||
|
|
|
@ -5,6 +5,7 @@ Find the value of d < 1000 for which 1/d contains the longest recurring cycle
|
|||
in its decimal fraction part.
|
||||
"""
|
||||
|
||||
|
||||
def find_digit(numerator: int, digit: int) -> int:
|
||||
"""
|
||||
Considering any range can be provided,
|
||||
|
|
|
@ -19,4 +19,7 @@ if __name__ == "__main__":
|
|||
|
||||
print(len(links))
|
||||
for link in links:
|
||||
webbrowser.open(f"http://google.com{link.get('href')}")
|
||||
if link.text == "Maps":
|
||||
webbrowser.open(link.get("href"))
|
||||
else:
|
||||
webbrowser.open(f"http://google.com{link.get('href')}")
|
||||
|
|
Loading…
Reference in New Issue
Block a user