일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- map
- range
- 파이썬
- split
- SQL
- index
- If
- STR
- FOR
- sum
- list
- join
- and
- DART
- LOWER
- js
- 위코드
- or
- slice
- lambda
- Sorted
- WECODE
- MAX
- decorator
- enumerate
- len
- count
- iNT
- Algorithm
- Today
- Total
목록map (25)
코드로 우주평화
Given an array of numbers, check if any of the numbers are the character codes for lower case vowels (a, e, i, o, u). If they are, change the array value to a string of that vowel. Return the resulting array. Solution: function isVow(a){ for (let index in a) { let vow = String.fromCharCode(a[index]) if (["a", "e", "i", "o", "u"].includes(vow)) { a[index] = vow } } return a } const isVow = a => a..
Create a function that returns the CSV representation of a two-dimensional numeric array. Example: input: [[ 0, 1, 2, 3, 4 ], [ 10,11,12,13,14 ], [ 20,21,22,23,24 ], [ 30,31,32,33,34 ]] output: '0,1,2,3,4\n' +'10,11,12,13,14\n' +'20,21,22,23,24\n' +'30,31,32,33,34' Array's length > 2. Solution: def to_csv_text(array): return '\n'.join(','.join(map(str, i)) for i in array)
The male gametes or sperm cells in humans and other mammals are heterogametic and contain one of two types of sex chromosomes. They are either X or Y. The female gametes or eggs however, contain only the X sex chromosome and are homogametic. The sperm cell determines the sex of an individual in this case. If a sperm cell containing an X chromosome fertilizes an egg, the resulting zygote will be ..
Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers. Return your answer as a number. sum_mix = lambda x: sum(map(int, x))
nput: Array of elements ["h","o","l","a"] Output: String with comma delimited elements of the array in th same order. "h,o,l,a" solution: def print_array(arr): return ','.join(map(str, arr))
Exclusive "or" (xor) Logical Operator Overview In some scripting languages like PHP, there exists a logical operator (e.g. &&, ||, and, or, etc.) called the "Exclusive Or" (hence the name of this Kata). The exclusive or evaluates two booleans. It then returns true if exactly one of the two expressions are true, false otherwise. For example: false xor false == false // since both are false true x..
Create a function that takes 2 integers in form of a string as an input, and outputs the sum (also as a string): Example: (Input1, Input2 -->Output) "4", "5" --> "9" "34", "5" --> "39" "", "" --> "0" "2", "" --> "2" "-5", "3" --> "-2" Notes: If either input is an empty string, consider it as zero. Inputs and the expected output will never exceed the signed 32-bit integer limit (2^31 - 1) Solutio..
You are required to create a simple calculator that returns the result of addition, subtraction, multiplication or division of two numbers. Your function will accept three arguments: The first and second argument should be numbers. The third argument should represent a sign indicating the operation to perform on these two numbers. if the variables are not numbers or the sign does not belong to t..
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..
Write a function named sumDigits which takes a number as input and returns the sum of the absolute value of each of the number's decimal digits. For example: (Input --> Output) 10 --> 1 99 --> 18 -32 --> 5 Let's assume that all numbers in the input will be integer values. Solution: def get_str_number(func): def wrapper(number): return func(str(number).replace("-", "")) return wrapper @get_str_nu..