일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- or
- enumerate
- 위코드
- SQL
- count
- WECODE
- 파이썬
- FOR
- Python
- STR
- Algorithm
- slice
- lambda
- LOWER
- split
- DART
- join
- list
- sum
- MAX
- and
- index
- map
- range
- len
- js
- Sorted
- If
- decorator
- iNT
- Today
- Total
목록or (22)
코드로 우주평화
Create a function that gives a personalized greeting. This function takes two parameters: name and owner. Use conditionals to return the proper message: case name equals owner : 'Hello boss' otherwise : 'Hello guest' Solution: def greet(name: str, owner: str) -> str: return f"Hello {name == owner and 'boss' or 'guest'}"
Wolves have been reintroduced to Great Britain. You are a sheep farmer, and are now plagued by wolves which pretend to be sheep. Fortunately, you are good at spotting them. Warn the sheep in front of the wolf that it is about to be eaten. Remember that you are standing at the front of the queue which is at the end of the array: [sheep, sheep, sheep, sheep, sheep, wolf, sheep, sheep] (YOU ARE HER..
Jamie is a programmer, and James' girlfriend. She likes diamonds, and wants a diamond string from James. Since James doesn't know how to make this happen, he needs your help. Task You need to return a string that looks like a diamond shape when printed on the screen, using asterisk (*) characters. Trailing spaces should be removed, and every line must be terminated with a newline character (\n)...
The maximum sum subarray problem consists in finding the maximum sum of a contiguous subsequence in an array or list of integers: max_sequence([-2, 1, -3, 4, -1, 2, 1, -5, 4]) # should be 6: [4, -1, 2, 1] Easy case is when the list is made up of only positive numbers and the maximum sum is the sum of the whole array. If the list is made up of only negative numbers, return 0 instead. Empty list i..
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 (..
Given two numbers and an arithmetic operator (the name of it, as a string), return the result of the two numbers having that operator used on them. a and b will both be positive integers, and a will always be the first number in the operation, and b always the second. The four operators are "add", "subtract", "divide", "multiply". A few examples:(Input1, Input2, Input3 --> Output) 5, 2, "add" --..
Build Tower Build a pyramid-shaped tower given a positive integer number of floors. A tower block is represented with "*" character. For example, a tower with 3 floors looks like this: [ " * ", " *** ", "*****" ] And a tower with 6 floors looks like this: [ " * ", " *** ", " ***** ", " ******* ", " ********* ", "***********" ] Solution: def tower_builder(n_floors): nums = [i>0 and i*2+1 or 1 for..
Write function bmi that calculates body mass index (bmi = weight / height2). if bmi 25 and "Overweight") \ or (bmi > 18.5 and "Normal") \ or "Underweight"
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..
There is truly no magic in the world; the Hogwarts Sorting Hat is SQL-based, its decision-making powers are common operators and prospectIve students are merely data - names, and two columns of qualities. students id name quality1 quality2 Slytherin are being quite strict this year and will only take students who are evil AND cunning. Gryffindor will take students who are brave but only if their..