Skip to content

Commit

Permalink
Merge pull request mouredev#4478 from RobTov/ex31_py
Browse files Browse the repository at this point in the history
Reto mouredev#31 - Python
  • Loading branch information
kontroldev authored Aug 4, 2023
2 parents 6955e86 + 719ef7b commit 1f58b26
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Retos/Reto #31 - EL ÁBACO [Fácil]/python/RobTov.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# One line solution

def read_abbacus(abbacus: list) -> str:
return ''.join(f'{len(r[:r.index("-")])}.' if abbacus.index(r) == 0 or abbacus.index(r) == 3 else str(len(r[:r.index('-')])) for r in abbacus)


if __name__ == '__main__':
print(read_abbacus(
[
'O---OOOOOOOO',
'OOO---OOOOOO',
'---OOOOOOOOO',
'OO---OOOOOOO',
'OOOOOOO---OO',
'OOOOOOOOO---',
'---OOOOOOOOO'
]
))

0 comments on commit 1f58b26

Please sign in to comment.