def solution(num_list):
if num_list[-2] < num_list[-1]:
output = num_list[-1] - num_list[-2]
else:
output = num_list[-1]*2
num_list.append(output)
return num_list
def solution(l):
l.append(l[-1]-l[-2] if l[-1]>l[-2] else l[-1]*2)
return l
'코딩테스트 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 두 수의 나눗셈 파이썬 (0) | 2023.08.28 |
---|---|
[프로그래머스] 수 조작하기 1 파이썬 (0) | 2023.08.28 |
[프로그래머스] 주사위 게임2 파이썬 (0) | 2023.08.28 |
[프로그래머스] 두 수의 연산값 비교하기 파이썬 (0) | 2023.08.27 |
[프로그래머스] 문자 리스트를 문자열로 변환하기 (0) | 2023.08.27 |