Skip to content

Commit 5c092e6

Browse files
cclaussgithub-actions
authored andcommitted
Deal with maps (TheAlgorithms#1945)
* Deal with maps Try with the search term "pizza" to see why this was done in TheAlgorithms#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>
1 parent cf76dac commit 5c092e6

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

DIRECTORY.md

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* [All Permutations](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_permutations.py)
1616
* [All Subsequences](https://github.com/TheAlgorithms/Python/blob/master/backtracking/all_subsequences.py)
1717
* [Coloring](https://github.com/TheAlgorithms/Python/blob/master/backtracking/coloring.py)
18+
* [Hamiltonian Cycle](https://github.com/TheAlgorithms/Python/blob/master/backtracking/hamiltonian_cycle.py)
1819
* [Minimax](https://github.com/TheAlgorithms/Python/blob/master/backtracking/minimax.py)
1920
* [N Queens](https://github.com/TheAlgorithms/Python/blob/master/backtracking/n_queens.py)
2021
* [Sudoku](https://github.com/TheAlgorithms/Python/blob/master/backtracking/sudoku.py)
@@ -89,6 +90,7 @@
8990
* [Number Of Possible Binary Trees](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/number_of_possible_binary_trees.py)
9091
* [Red Black Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/red_black_tree.py)
9192
* [Segment Tree](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/segment_tree.py)
93+
* [Segment Tree Other](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/segment_tree_other.py)
9294
* [Treap](https://github.com/TheAlgorithms/Python/blob/master/data_structures/binary_tree/treap.py)
9395
* Data Structures
9496
* Heap
@@ -499,6 +501,8 @@
499501
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol1.py)
500502
* [Sol2](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol2.py)
501503
* [Sol3](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_25/sol3.py)
504+
* Problem 26
505+
* [Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_26/sol1.py)
502506
* Problem 27
503507
* [Problem 27 Sol1](https://github.com/TheAlgorithms/Python/blob/master/project_euler/problem_27/problem_27_sol1.py)
504508
* Problem 28

maths/armstrong_numbers.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ def armstrong_number(n: int) -> bool:
4141
temp //= 10
4242
return n == sum
4343

44-
def narcissistic_number(n:int) -> bool:
44+
45+
def narcissistic_number(n: int) -> bool:
4546
"""Return True if n is a narcissistic number or False if it is not"""
46-
47-
expo = len(str(n)) #power, all number will be raised to
48-
temp = [(int(i)**expo) for i in str(n)] # each digit will be multiplied expo times
49-
50-
# check if sum of cube of each digit is equal to number
47+
48+
expo = len(str(n)) # power, all number will be raised to
49+
# each digit will be multiplied expo times
50+
temp = [(int(i) ** expo) for i in str(n)]
51+
52+
# check if sum of cube of each digit is equal to number
5153
return n == sum(temp)
5254

55+
5356
def main():
5457
"""
5558
Request that user input an integer and tell them if it is Armstrong number.

project_euler/problem_26/sol1.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
in its decimal fraction part.
66
"""
77

8+
89
def find_digit(numerator: int, digit: int) -> int:
910
"""
1011
Considering any range can be provided,

web_programming/crawl_google_results.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@
1919

2020
print(len(links))
2121
for link in links:
22-
webbrowser.open(f"http://google.com{link.get('href')}")
22+
if link.text == "Maps":
23+
webbrowser.open(link.get("href"))
24+
else:
25+
webbrowser.open(f"http://google.com{link.get('href')}")

0 commit comments

Comments
 (0)