일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- map
- SQL
- or
- iNT
- 위코드
- STR
- lambda
- index
- slice
- len
- range
- count
- js
- Algorithm
- WECODE
- decorator
- Sorted
- LOWER
- DART
- join
- enumerate
- sum
- If
- and
- FOR
- split
- MAX
- list
- 파이썬
- Python
- Today
- Total
목록count (18)
코드로 우주평화
Consider an array/list of sheep where some sheep may be missing from their place. We need a function that counts the number of sheep present in the array (true means present). For example, [True, True, True, False, True, True, True, True , True, False, True, False, True, False, False, True , True, True, True, True , False, False, True, True] The correct answer would be 17. Hint: Don't forget to ..
Your car is old, it breaks easily. The shock absorbers are gone and you think it can handle about 15 more bumps before it dies totally. Unfortunately for you, your drive is very bumpy! Given a string showing either flat road (_) or bumps (n). If you are able to reach home safely by encountering 15 bumps or less, return Woohoo!, otherwise return Car Dead Solution: def bumps(road): return road.cou..
Create a method that accepts a list and an item, and returns true if the item belongs to the list, otherwise false. Solution: from typing import List def include(arr: List[int], item: int) -> bool: return bool(arr.count(item))
This Kata is intended as a small challenge for my students All Star Code Challenge #18 Create a function that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one. If no occurrences can be found, a count of 0 should be returned. ("Hello", "o") ==> 1 ("Hello", "l") ==> 2 ("", "z") ==> 0 Notes: The first argument can be an empty s..
You are given an odd-length array of integers, in which all of them are the same, except for one single number. Complete the method which accepts such an array, and returns that single different number. The input array will always be valid! (odd-length >= 3) Examples [1, 1, 2] ==> 2 [17, 17, 3, 17, 17, 17, 17] ==> 3 Solution: def stray(arr): import collections return [k for k, v in collections.C..
There is an array with some numbers. All numbers are equal except for one. Try to find it! find_uniq([ 1, 1, 1, 2, 1, 1 ]) == 2 find_uniq([ 0, 0, 0.55, 0, 0 ]) == 0.55 It’s guaranteed that array contains at least 3 numbers. The tests contain some very huge arrays, so think about performance. Solution: def find_uniq(arr): n = arr[0] == arr[-1] and arr[0] or arr[1] return [i for i in arr if n != i..
Take an integer n (n >= 0) and a digit d (0
or this challenge you need to create a simple SELECT statement that will return all columns from the people table, and join to the toys table so that you can return the COUNT of the toys people table schema id name toys table schema id name people_id You should return all people fields as well as the toy count as "toy_count". Solution: SELECT p.id, p.name, COUNT(t.name) AS toy_count FROM people ..
You are the owner of the Grocery Store. All your products are in the database, that you have created after CodeWars SQL excercises!:) You have reached a conclusion that you waste to much time because you have to many different warehouse to visit each week. You have to find out how many different type of products you buy from each producer. If you take only few items from some of them you will st..
Overview For this kata we will be using the DVD Rental database. You are working for a company that wants to reward its top 10 customers with a free gift. You have been asked to generate a simple report that returns the top 10 customers by total amount spent ordered from highest to lowest. Total number of payments has also been requested. The query should output the following columns: customer_i..