mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-30 16:31:08 +00:00
Compare commits
4 Commits
2b6c79a06b
...
1f57975ba1
Author | SHA1 | Date | |
---|---|---|---|
|
1f57975ba1 | ||
|
e3bd7721c8 | ||
|
e3f3d668be | ||
|
81fe9ed382 |
|
@ -16,7 +16,7 @@ repos:
|
||||||
- id: auto-walrus
|
- id: auto-walrus
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.7.2
|
rev: v0.7.3
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
- id: ruff-format
|
- id: ruff-format
|
||||||
|
@ -42,7 +42,7 @@ repos:
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
|
|
||||||
- repo: https://github.com/abravalheri/validate-pyproject
|
- repo: https://github.com/abravalheri/validate-pyproject
|
||||||
rev: v0.22
|
rev: v0.23
|
||||||
hooks:
|
hooks:
|
||||||
- id: validate-pyproject
|
- id: validate-pyproject
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ def solved(values):
|
||||||
|
|
||||||
def from_file(filename, sep="\n"):
|
def from_file(filename, sep="\n"):
|
||||||
"Parse a file into a list of strings, separated by sep."
|
"Parse a file into a list of strings, separated by sep."
|
||||||
return open(filename).read().strip().split(sep) # noqa: SIM115
|
return open(filename).read().strip().split(sep)
|
||||||
|
|
||||||
|
|
||||||
def random_puzzle(assignments=17):
|
def random_puzzle(assignments=17):
|
||||||
|
|
|
@ -43,9 +43,9 @@ def armstrong_number(n: int) -> bool:
|
||||||
def pluperfect_number(n: int) -> bool:
|
def pluperfect_number(n: int) -> bool:
|
||||||
"""Return True if n is a pluperfect number or False if it is not
|
"""Return True if n is a pluperfect number or False if it is not
|
||||||
|
|
||||||
>>> all(armstrong_number(n) for n in PASSING)
|
>>> all(pluperfect_number(n) for n in PASSING)
|
||||||
True
|
True
|
||||||
>>> any(armstrong_number(n) for n in FAILING)
|
>>> any(pluperfect_number(n) for n in FAILING)
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
if not isinstance(n, int) or n < 1:
|
if not isinstance(n, int) or n < 1:
|
||||||
|
@ -70,9 +70,9 @@ def pluperfect_number(n: int) -> bool:
|
||||||
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.
|
"""Return True if n is a narcissistic number or False if it is not.
|
||||||
|
|
||||||
>>> all(armstrong_number(n) for n in PASSING)
|
>>> all(narcissistic_number(n) for n in PASSING)
|
||||||
True
|
True
|
||||||
>>> any(armstrong_number(n) for n in FAILING)
|
>>> any(narcissistic_number(n) for n in FAILING)
|
||||||
False
|
False
|
||||||
"""
|
"""
|
||||||
if not isinstance(n, int) or n < 1:
|
if not isinstance(n, int) or n < 1:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!python
|
||||||
import os
|
import os
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user