-
""" 출처:프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/77885 """ # 풀이 과정 def solution(numbers): result = [] for a in numbers: k = list(str(bin(a))[2:]) t = k[::-1] flag = False for b in range(len(t)): if t[b] == "0": c = b flag = True break if flag == True: d = "1" + "0" * (b - 1) e = int(d, 2) result.append(a + e) else: d = "1" + "0" * (len(k) - 1) e = int(d, 2) result.append(a + e) return result
-
""" 출처:프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/120821 """ # 풀이 과정 def solution(num_list): num_list.reverse() return num_list
-
""" 출처: 프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/120809 """ # 풀이 과정 def solution(numbers): for a in range(len(numbers)): numbers[a] = numbers[a] * 2 return numbers
-
""" 출처: 프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/181871 """ # 풀이 과정 def solution(myString, pat): result = [] for x in range(len(myString)): k = myString.find(pat, x) result.append(k) return len(set(result) - {-1})
-
""" 출처: 프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/181907 """ # 풀이 과정 def solution(my_string, n): return my_string[0:n]
-
""" 출처: 프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/120911 """ # 풀이 과정 def solution(my_string): a=my_string.lower() b=list(a) answer = "".join(b) return answer
-
""" 출처:프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/120850 """ # 풀이 과정 def solution(my_string): a = "abcdefghijklmnopqrstuvwxyz" b = a.upper() result = [] x = list(my_string) for c in range(len(x)): if x[c] in a or x[c] in b: continue else: result.append(x[c]) result.sort() answer = map(int, result) return list(answer)
-
""" 출처:프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/181866 """ # 풀이 과정 def solution(myString): k=myString.split("x") result=[] for x in k: if x=='': continue else:result.append(x) answer = result answer.sort() return answer
-
""" 출처:프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/181913 """ # 풀이 과정 def solution(my_string, queries): for x, y in queries: count = 0 sub_string = list(my_string[x:y + 1]) sub_string.reverse() for z in range(x, y + 1): my_string = list(my_string) my_string[z] = sub_string[count] count += 1 my_string = "".join(my_string) return my_string
-
""" 출처: 프로그래머스, https://school.programmers.co.kr/learn/courses/30/lessons/120908 """ # 풀이 과정 def solution(str1, str2): if str2 in str1: return 1 else:return 2