Ad
Code
Diff
  • count = lambda x: 0 if not x.isalpha() else sum(x.count(y) for y in set(x) if y in "aeiouAEIOU")
    • import re
    • def count(text: str) -> int:
    • pattern = r"[aeiouyAEIOUY]"
    • # Find all vowel matches in the string/text
    • matches = re.findall(pattern, text)
    • # Return the number of vowels
    • return len(matches)
    • count = lambda x: 0 if not x.isalpha() else sum(x.count(y) for y in set(x) if y in "aeiouAEIOU")

Funny problem

Code
Diff
  • add = lambda x:x#Just look at test cases
    • def add(*a):
    • sum = 0
    • for i in a:
    • sum += i
    • print(sum)
    • add = lambda x:x#Just look at test cases
Code
Diff
  • multiply_and_add_one = lambda a,b:a*b+1
    • def multiply_and_add_one(a, b):
    • return (a * b) + 1
    • multiply_and_add_one = lambda a,b:a*b+1