본문 바로가기

분류 전체보기824

Descending Order Your task is to make a function that can take any non-negative integer as an argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number. Examples: Input: 42145 Output: 54421 Input: 145263 Output: 654321 Input: 123456789 Output: 987654321 Solution: def descending_order(num): return int("".join(sorted([i for i in str(num)], r.. 2022. 8. 5.
Small enough? - Beginner You will be given an array and a limit value. You must check that all values in the array are below or equal to the limit value. If they are, return true. Else, return false. You can assume all values in the array are numbers. Solution: def small_enough(array, limit): return max(array) 2022. 8. 3.
Sort the odd Task You will be given an array of numbers. You have to sort the odd numbers in ascending order while leaving the even numbers at their original positions. Examples [7, 1] => [1, 7] [5, 8, 6, 3, 4] => [3, 8, 6, 5, 4] [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] => [1, 8, 3, 6, 5, 4, 7, 2, 9, 0] Solution: def sort_array(source_array): a,b = [],[] for i, v in enumerate(source_array): if v%2==1: a.append(v) b.ap.. 2022. 8. 2.
Form The Minimum Task Given a list of digits, return the smallest number that could be formed from these digits, using the digits only once (ignore duplicates). Notes: Only positive integers will be passed to the function (> 0 ), no negatives or zeros. Input >> Output Examples minValue ({1, 3, 1}) ==> return (13) Explanation: (13) is the minimum number could be formed from {1, 3, 1} , Without duplications minVal.. 2022. 8. 2.
Make a function that does arithmetic! Given two numbers and an arithmetic operator (the name of it, as a string), return the result of the two numbers having that operator used on them. a and b will both be positive integers, and a will always be the first number in the operation, and b always the second. The four operators are "add", "subtract", "divide", "multiply". A few examples:(Input1, Input2, Input3 --> Output) 5, 2, "add" --.. 2022. 7. 31.
2022년 31주차 'SUPER 주니어 개발자' Weekly growth 클린 코더스 스터디 16강 ~ 20강을 듣고 정리하여 공유했다. 월요일 스터디 예정. 사내 독서모임 - 첫 번째 모임 사실 좀 긴장을 했었는데 다들 너무 잘 준비하고 생각을 나눠줘서 깜짝 놀랐다. 독서모임 경험이 거의 없었다고 했는데 어느 독서모임보다도 퀄리티가 높았다... 긍정적인 요인이 되었던 것을 꼽아보자면 다음과 같다. 1. 사전 템플릿을 활용하여 나누고 싶은 내용을 미리 공유했다. 2. 적은 시간 내에 끝마쳐야 했기 때문에 다들 핵심만 명확히 전달하는데 집중했다. 3. 모든 것이 기록으로 남겨져 있어 독서모임이 끝난 후에 전체 채널에 공유하는 것이 용이했다. 독서모임에 참여하신 동료분들은 대부분 긍정적 반응을 보여주셨다. 사내 독서모임은 개인적인 로망 중에 하나였는데 이.. 2022. 7. 31.