일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- list
- 위코드
- js
- len
- Sorted
- Python
- decorator
- sum
- LOWER
- map
- If
- MAX
- join
- STR
- FOR
- 파이썬
- or
- slice
- enumerate
- and
- count
- WECODE
- range
- SQL
- iNT
- index
- DART
- lambda
- Algorithm
- split
- Today
- Total
목록list (16)
코드로 우주평화
Write a function reverse which reverses a list (or in clojure's case, any list-like data structure) (the dedicated builtin(s) functionalities are deactivated) Solution: def reverse(lst): result = list() for _ in range(len(lst)): result.append(lst.pop()) return result
Create a function that accepts a list/array and a number n, and returns a list/array of the first n elements from the list/array. Solution: def take(arr, n): result = [] arrs = [arr[i-1:i] for i in range(1, n+1)] for arr in arrs: result += arr return result
The wide-mouth frog is particularly interested in the eating habits of other creatures. He just can't stop asking the creatures he encounters what they like to eat. But, then he meets the alligator who just LOVES to eat wide-mouthed frogs! When he meets the alligator, it then makes a tiny mouth. Your goal in this kata is to create complete the mouth_size method this method takes one argument ani..
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example: 5! = 5 * 4 * 3 * 2 * 1 = 120. By convention the value of 0! is 1. Write a function to calculate factorial for a given input. If input is below 0 or above 12 throw an exception of type ArgumentOutOfRangeException (C#) or IllegalArgumentException (..
The Western Suburbs Croquet Club has two categories of membership, Senior and Open. They would like your help with an application form that will tell prospective members which category they will be placed. To be a senior, a member must be at least 55 years old and have a handicap greater than 7. In this croquet club, handicaps range from -2 to +26; the better the player the lower the handicap. I..
Description: Simple, given a string of words, return the length of the shortest word(s). String will never be empty and you do not need to account for different data types. Solution: 1. Count the number of letters in each word. 2. Returns the smallest number of characters. def find_short(s): return min(list(map(len, s.split())))
Description: Our football team finished the championship. The result of each match look like "x:y". Results of all matches are recorded in the collection. For example: ["3:1", "2:2", "0:1", ...] Write a function that takes such collection and counts the points of our team in the championship. Rules for counting points for each match: if x > y: 3 points if x < y: 0 point if x = y: 1 point Notes: ..
Description: Given an array of integers, return a new array with each value doubled. For example: [1, 2, 3] --> [2, 4, 6] Solution: 1. Get the elements out of the array. 2. Multiply the element by 2 and put it back into the array. 3. Return an array. def maps(a): return list(map(lambda x: x * 2, a)) The lambda function is an anonymous function and is suitable for simple calculations.
Description: You get an array of arrays. If you sort the arrays by their length, you will see, that their length-values are consecutive. But one array is missing! You have to write a method, that return the length of the missing array. Example: [[1, 2], [4, 5, 1, 1], [1], [5, 6, 7, 8, 9]] --> 3 If the array of arrays is null/nil or empty, the method should return 0. When an array in the array is..
Description: Input : an array of integers. Output : this array, but sorted in such a way that there are two wings: the left wing with numbers decreasing, the right wing with numbers increasing. the two wings have the same length. If the length of the array is odd the wings are around the bottom, if the length is even the bottom is considered to be part of the right wing. each integer l of the le..