728x90
1. Problem: https://py.checkio.org/en/mission/beat-the-previous/
2. My solution
def beat_previous(digits: str) -> list[int]:
# your code here
dummy_list = []
list_digits = list(digits)
dummy_number = "0"
for index in range(len(list_digits)):
if index == 0:
dummy_list.append(int(list_digits[index]))
else:
dummy_number+=list_digits[index]
if int(dummy_number) <= dummy_list[-1]: continue
else:
dummy_list.append(int(dummy_number))
dummy_number = ""
return dummy_list
728x90
'프로그래밍 문제 > [Python] CheckIO' 카테고리의 다른 글
[CheckIO/Scientific-Expedition] Secret Message (0) | 2024.04.07 |
---|---|
[CheckIO/Scientific Expedition] striped words (0) | 2024.03.24 |
[CheckIO/Scientific Expedition] Pangram (0) | 2024.03.24 |
[CheckIO][Scientific Expedition] Latest-iso-datetime (0) | 2024.02.18 |
[CheckIO/Scientific Expedition] Longest substring of unique characters (0) | 2024.02.18 |
댓글