Deal with maps (#1945) · coderjack/algorithms-in-python@08c8bb5 · GitHub
Skip to content

Commit 08c8bb5

Browse files
cclaussgithub-actions
andauthored
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 1e84aab commit 08c8bb5

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

DIRECTORY.md

Lines changed: 4 additions & 0 deletions

maths/armstrong_numbers.py

Lines changed: 9 additions & 6 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 1 deletion

0 commit comments

Comments
 (0)