Skip to content

Commit

Permalink
Deal with maps (TheAlgorithms#1945)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
cclauss and github-actions authored May 6, 2020
1 parent 1e84aab commit 08c8bb5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions DIRECTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions maths/armstrong_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions project_euler/problem_26/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
in its decimal fraction part.
"""


def find_digit(numerator: int, digit: int) -> int:
"""
Considering any range can be provided,
Expand Down
5 changes: 4 additions & 1 deletion web_programming/crawl_google_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@

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')}")

0 comments on commit 08c8bb5

Please sign in to comment.