728x90
Programmers
조건에 맞게 수열 변환하기 3
https://school.programmers.co.kr/learn/courses/30/lessons/181835
문제
코드
def solution(arr, k):
answer = []
for i in arr:
if k % 2 != 0:
answer.append(i * k)
else:
answer.append(i + k)
return answer
Reference
728x90
반응형
'Algorithm > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 특별한 이차원 배열 1 - 파이썬 (1) | 2024.03.29 |
---|---|
[프로그래머스] I로 만들기 - 파이썬 (1) | 2024.03.29 |
[프로그래머스] 그림 확대 - 파이썬 (1) | 2024.03.29 |
[프로그래머스] 주사위 게임 1 - 파이썬 (0) | 2024.03.29 |
[프로그래머스] 모음 제거 - 파이썬 (0) | 2024.03.28 |