일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- iNT
- enumerate
- FOR
- index
- WECODE
- STR
- Python
- map
- and
- slice
- DART
- count
- SQL
- len
- Sorted
- lambda
- 위코드
- 파이썬
- LOWER
- join
- range
- or
- sum
- decorator
- split
- If
- Algorithm
- MAX
- list
- js
- Today
- Total
목록FOR (78)
코드로 우주평화
Is the string uppercase? Task Create a method to see whether the string is ALL CAPS. Examples (input -> output) "c" -> False "C" -> True "hello I AM DONALD" -> False "HELLO I AM DONALD" -> True "ACSKLDFJSgSKLDFJSKLDFJ" -> False "ACSKLDFJSGSKLDFJSKLDFJ" -> True In this Kata, a string is said to be in ALL CAPS whenever it does not contain any lowercase letter so any string containing no letters at..
Messi goals function Messi is a soccer player with goals in three leagues: LaLiga Copa del Rey Champions Complete the function to return his total number of goals in all three leagues. Note: the input will always be valid. For example: 5, 10, 2 --> 17 Solution: int goals(int laLigaGoals, int copaDelReyGoals, int championsLeagueGoals) { return add_nums([laLigaGoals, copaDelReyGoals, championsLeag..
Complete the square sum function so that it squares each number passed into it and then sums the results together. For example, for [1, 2, 2] it should return 9 because 1^2 + 2^2 + 2^2 = 9. Solution: def square_sum(numbers): square = lambda x:(x**2+x**2)//2 return sum(square(number) for number in numbers)
Given an array of integers. Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers. 0 is neither positive nor negative. If the input is an empty array or is null, return an empty array. Example For input [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15], you should return [10, -65]. Solution: def sorted_arr(func): def w..
Kata Task I have a cat and a dog. I got them at the same time as kitten/puppy. That was humanYears years ago. Return their respective ages now as [humanYears,catYears,dogYears] NOTES: humanYears >= 1 humanYears are whole numbers only Cat Years 15 cat years for first year +9 cat years for second year +4 cat years for each year after that Dog Years 15 dog years for first year +9 dog years for seco..
Your task is to find the first element of an array that is not consecutive. By not consecutive we mean not exactly 1 larger than the previous element of the array. E.g. If we have an array [1,2,3,4,6,7,8] then 1 then 2 then 3 then 4 are all consecutive but 6 is not, so that's the first non-consecutive number. If the whole array is consecutive then return null2. The array will always have at leas..
Given a string, capitalize the letters that occupy even indexes and odd indexes separately, and return as shown below. Index 0 will be considered even. For example, capitalize("abcdef") = ['AbCdEf', 'aBcDeF']. See test cases for more examples. The input will be a lowercase string with no spaces. Good luck! Solution: def capitalize(s): return [''.join(v.lower() if i%2==1 else v.upper() for i, v i..
Challenge: Given a two-dimensional array of integers, return the flattened version of the array with all the integers in the sorted (ascending) order. Example: Given [[3, 2, 1], [4, 6, 5], [], [9, 7, 8]], your function should return [1, 2, 3, 4, 5, 6, 7, 8, 9]. Solution: def flatten_and_sort(array): arr = [] for i in array: arr.extend(i) return sorted(arr) Other Solution: from itertools import c..
If you can't sleep, just count sheep!! Task: Given a non-negative integer, 3 for example, return a string with a murmur: "1 sheep...2 sheep...3 sheep...". Input will always be valid, i.e. no negative integers. Solution: def count_sheep(n): return ''.join(f"{i} sheep..." for i in range(1, n+1))
Some numbers have funny properties. For example: 89 --> 8¹ + 9² = 89 * 1 695 --> 6² + 9³ + 5⁴= 1390 = 695 * 2 46288 --> 4³ + 6⁴+ 2⁵ + 8⁶ + 8⁷ = 2360688 = 46288 * 51 Given a positive integer n written as abcd... (a, b, c, d... being digits) and a positive integer p we want to find a positive integer k, if it exists, such that the sum of the digits of n taken to the successive powers of p is equal..