일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 위코드
- js
- Sorted
- count
- enumerate
- and
- index
- join
- If
- FOR
- Algorithm
- map
- 파이썬
- iNT
- DART
- Python
- slice
- decorator
- sum
- STR
- SQL
- WECODE
- or
- lambda
- split
- LOWER
- len
- MAX
- list
- range
- Today
- Total
목록sum (56)
코드로 우주평화
Your task is to write function findSum. Upto and including n, this function will return the sum of all multiples of 3 and 5. For example: findSum(5) should return 8 (3 + 5) findSum(10) should return 33 (3 + 5 + 6 + 9 + 10) Solution: def find(n): return sum([i for i in range(1, n+1) if i%3 == 0 or i%5 == 0]) 1. Find a number less than 'n'. 2. Find a number that is divisible by 3 or divisible by 5..
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..
For this challenge you need to create a simple query to display each unique clan with their total points and ranked by their total points. people table schema name points clan You should then return a table that resembles below select on rank clan total_points total_people The query must rank each clan by their total_points, you must return each unqiue clan and if there is no clan name (i.e. it'..
It's time to assess which of the world's greatest fighters are through to the 6 coveted places in the semi-finals of the Street Fighter World Fighting Championship. Every fight of the year has been recorded and each fighter's wins and losses need to be added up. Each row of the table fighters records, alongside the fighter's name, whether they won (1) or lost (0), as well as the type of move tha..
For this challenge you need to create a simple SUM statement that will sum all the ages. people table schema id name age select table schema age_sum (sum of ages) Solution: SELECT SUM(age) AS age_sum FROM people; Result: age_sum 5451
There is a bus moving in the city, and it takes and drop some people in each bus stop. You are provided with a list (or array) of integer pairs. Elements of each pair represent number of people get into bus (The first item) and number of people get off the bus (The second item) in a bus stop. Your task is to return number of people who are still in the bus after the last bus station (after the l..
Task: Given a list of integers, determine whether the sum of its elements is odd or even. Give your answer as a string matching "odd" or "even". If the input array is empty consider it as: [0] (array with a zero). Examples: Input: [0] Output: "even" Input: [0, 1, 4] Output: "odd" Input: [0, -1, -5] Output: "even" Have fun! Solution: 1. Check if the sum of the array is odd. 2. If true, return "od..
Description: Given the triangle of consecutive odd numbers: 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 ... Calculate the sum of the numbers in the nth row of this triangle (starting at index 1) e.g.: (Input --> Output) 1 --> 1 2 --> 3 + 5 = 8 Solution: 1. Add up all 'n' numbers. 2. Find the odd number by the added number. 3. It returns after adding 'n' odd numbers from the last. def row_sum_odd_num..
Description: Your colleagues have been looking over you shoulder. When you should have been doing your boring real job, you've been using the work computers to smash in endless hours of codewars. In a team meeting, a terrible, awful person declares to the group that you aren't working. You're in trouble. You quickly have to gauge the feeling in the room to decide whether or not you should gather..
Description: Return the number (count) of vowels in the given string. We will consider a, e, i, o, u as vowels for this Kata (but not y). The input string will only consist of lower case letters and/or spaces. Solution: 1. Check whether the characters in the 'sentence' are included in 'aeiou'. 2. Returns the number of included characters. def get_count(sentence): return sum([i in 'aeiou' for i i..