mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +08:00
psf/black code formatting (#1277)
This commit is contained in:

committed by
Christian Clauss

parent
07f04a2e55
commit
9eac17a408
@ -28,23 +28,21 @@ def solution():
|
||||
162
|
||||
"""
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
wordsFilePath = os.path.join(script_dir, 'words.txt')
|
||||
wordsFilePath = os.path.join(script_dir, "words.txt")
|
||||
|
||||
words = ''
|
||||
with open(wordsFilePath, 'r') as f:
|
||||
words = ""
|
||||
with open(wordsFilePath, "r") as f:
|
||||
words = f.readline()
|
||||
|
||||
words = list(map(lambda word: word.strip('"'), words.strip('\r\n').split(',')))
|
||||
words = list(map(lambda word: word.strip('"'), words.strip("\r\n").split(",")))
|
||||
words = list(
|
||||
filter(
|
||||
lambda word: word in TRIANGULAR_NUMBERS,
|
||||
map(
|
||||
lambda word: sum(map(lambda x: ord(x) - 64, word)),
|
||||
words
|
||||
)
|
||||
map(lambda word: sum(map(lambda x: ord(x) - 64, word)), words),
|
||||
)
|
||||
)
|
||||
return len(words)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solution())
|
||||
|
Reference in New Issue
Block a user