return_10 = lambda: ord("d") - ord("Z")
import mathdef return_10():a = int((ord("}")*ord(""))**(ord("o")/ord("ō")))+1b = ((1+1)-(math.cos(69)**2 + math.sin(69)**2))-1c = ((2-1)-(math.cos(69)**2 + math.sin(69)**2))+1d = (1-27)*(4+27)+27*(4-1+27)-1return int(a - round(b - c, 0)) + int(math.sqrt(d)) - 2print(return_10())- return_10 = lambda: ord("d") - ord("Z")
import codewars_test as test # TODO Write tests from solution import return_10 # test.assert_equals(actual, expected, [optional] message) @test.describe("Example") def test_group(): @test.it("results in 10") def test_case(): test.assert_equals(return_10(), 10) @test.it("1000 tests") def test_cases(): for i in range(1000): test.assert_equals(return_10(), 10)
- import codewars_test as test
- # TODO Write tests
- from solution import return_10
- # test.assert_equals(actual, expected, [optional] message)
- @test.describe("Example")
- def test_group():
- @test.it("results in 10")
- def test_case():
- test.assert_equals(return_10(), 10)
- @test.it("1000 tests")
- def test_cases():
- for i in range(1000):
- test.assert_equals(return_10(), 10)
def addition(a, b): num_of_ones = [] for n in range(a): num_of_ones.append(1) for n in range(b): num_of_ones.append(1) return len(num_of_ones)
def c(a,b):d=lambda a,b: int(bin(a),2)+int(bin(b),2)def f():nonlocal anonlocal breturn d(a,b)return f()addition = c- def addition(a, b):
- num_of_ones = []
- for n in range(a):
- num_of_ones.append(1)
- for n in range(b):
- num_of_ones.append(1)
- return len(num_of_ones)
baked = lambda raw_cake: raw_cake.title() ingredients = {"c": 1, "a": 1, "k": 1, "e": 1} def cake_maker(word: str) -> str: raw_cake = "".join(ing for ing in ingredients.keys()) found_ingredients = "".join(i for i in 'cake' if i in word.lower()) return baked("cake") if raw_cake == found_ingredients else "Not enough to make the cake!"
- baked = lambda raw_cake: raw_cake.title()
- ingredients = {"c": 1,
- "a": 1,
- "k": 1,
- "e": 1}
- def cake_maker(word: str) -> str:
ingredients = 'cake'cake_mix = set()idx = 0while idx != len(word):if word[idx].lower() in ingredients:cake_mix.add(word[idx].lower())idx += 1if len(cake_mix) == len(ingredients):return 'Cake'return 'Not enough to make the cake!'- raw_cake = "".join(ing for ing in ingredients.keys())
- found_ingredients = "".join(i for i in 'cake' if i in word.lower())
- return baked("cake") if raw_cake == found_ingredients else "Not enough to make the cake!"
Description:
As input you recieve a random word.
Your job is to find out can you make a Cake from it.
That is done by finding all the letters that make the word "cake" in the given word.
If all of them are present, make the Cake and return it.
If not, say "Not enough to make the cake!".
Example:
Input: "Cupcake"
-->
Output: "Cake"
Input: "Coffee"
-->
Output: "Not enough to make the cake!"
Notes:
- It's not case sensitive, meaning that "Cupcake" and "CupCake" will both suffice to return the "Cake".
def cake_maker(word: str) -> str:
for let in "cake":
if let in word.lower():
continue
else: return "Not enough to make the cake!"
return "Cake"
import codewars_test as test
# TODO Write tests
import solution # or from solution import example
# test.assert_equals(actual, expected, [optional] message)
@test.describe("Example")
def test_group():
@test.it("Are you any good at baking cakes?")
def test_case():
test.assert_equals(cake_maker("Cupcake"), "Cake", "Should return 'Cake'")
test.assert_equals(cake_maker("Pancake"), "Cake", "Should return 'Cake'")
test.assert_equals(cake_maker("CheeseCake"), "Cake", "Should return 'Cake'")
test.assert_equals(cake_maker("RaCket"), "Cake", "Should return 'Cake'")
test.assert_equals(cake_maker("Take"), "Not enough to make the cake!", "Shouldn't return 'Cake'")
test.assert_equals(cake_maker("Lake"), "Not enough to make the cake!", "Shouldn't return 'Cake'")