def solution(numbers, direction):
answer = []
if direction == "right":
answer.append(numbers[-1])
for i in range(1, len(numbers)):
answer.append(numbers[i-1])
else:
for i in range(len(numbers)-1):
answer.append(numbers[i+1])
answer.append(numbers[0])
return answer
# 다른 사람의 풀이
def solution(numbers, direction):
if direction == "right":
answer = [numbers[-1]] + numbers[:len(numbers)-1]
else:
answer = numbers[1:] + [numbers[0]]
return answer
def solution(age):
answer = []
abc = 'abcdefghijklmnopqrstuvwxyz'
age = str(age)
for i in range(len(age)):
num = int(age[i])
answer.append(abc[num])
return ''.join(answer)
# 다른 사람의 풀이
def solution(age):
change = ['a','b','c','d','e','f','g','h','i','j']
age = list(str(age))
return ''.join([change[int(i)] for i in age])
def solution(my_string, num1, num2):
mylist = list(my_string)
a = mylist[num1]
b = mylist[num2]
mylist[num1] = b
mylist[num2] = a
my_string = ''.join(mylist)
return my_string
최댓값 만들기 (2)
https://school.programmers.co.kr/learn/courses/30/lessons/120862
#아직 해결 못했다
코드를 입력하세요
코드를 입력하세요
코드를 입력하세요