You received a whatsup message from an unknown number. Could it be from that girl/boy with a foreign accent you met yesterday evening?

Write a simple regex to check if the string contains the word hallo in different languages.

These are the languages of the possible people you met the night before:

* hello - english
* ciao - italian
* salut - french
* hallo - german
* hola - spanish
* ahoj - czech republic
* czesc - polish

By the way, how cool is the czech republic hallo!!


PS. you can assume the input is a string.
PPS. to keep this a beginner exercise you don't need to check if the greeting is a subset of word ('Hallowen' can pass the test)

PS. regex should be case insensitive to pass the tests

Difficulty: introductory

Starter code:

def validate_hello(greetings):
	

Solutions:
def validate_hello(greetings):
    return any(x in greetings.lower() for x in ['hello','ciao','salut','hallo','hola','ahoj','czesc'])

from re import compile, search, I

REGEX = compile(r'hello|ciao|salut|hallo|hola|ahoj|czesc', I)


def validate_hello(greeting):
    return bool(search(REGEX, greeting))


import re

def validate_hello(greetings):
    return bool(re.search("h[ae]llo|ciao|salut|hola|ahoj|czesc", greetings.lower()))

def validate_hello(greetings):
    g = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for s in g:
        if s in greetings.lower():
            return True
    return False

import re
def validate_hello(greetings):
    return True if re.findall('hello|ciao|salut|hallo|hola|ahoj|czesc', greetings, re.IGNORECASE) else False

import re


def validate_hello(greetings):
    allowed_re = re.compile(r'(h[ae]llo)|(ciao)|(salut)|(hola)|(ahoj)|(czesc)')
    return bool(allowed_re.search(greetings.lower()))

def validate_hello(greetings):
    check = False
    greeting = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for x in greeting:
        if x in greetings.lower():
            check = True
    return check

import re

check = re.compile(r"hello|ciao|salut|hallo|hola|ahoj|czesc", re.IGNORECASE).search

def validate_hello(greetings):
    return bool(check(greetings))

validate_hello = lambda g: any(bool(g.lower().count(s)) for s in ["hello","ciao","salut","hallo","hola","ahoj","czesc"])

def validate_hello(greetings):
    a=('hello','ciao','salut','hallo','hola','ahoj','czesc')
    for x in a:
        if x in greetings.lower():
            return True
    return False

def validate_hello(greetings):
    l = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    return any([True for i in l if i in greetings.lower()])

def validate_hello(greetings):
    return any(w in greetings.lower() for w in ("hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"))

import re

def validate_hello(greetings):
    return bool(re.search('ahoj|h[ea]llo|hola|czesc|ciao|salut', greetings, re.I))


from re import compile, search, I

LOL = compile(r'hello|ciao|salut|hallo|hola|ahoj|czesc', I)


def validate_hello(greeting):
    return bool(search(LOL, greeting))
    #your code here


validate_hello = lambda g: __import__('re').compile('(hello|ciao|salut|hallo|hola|ahoj|czesc)').search(g.lower()) is not None

import re
def validate_hello(greetings):
      return bool(re.search(r'(?i)(hello|ciao|salut|hallo|hola|ahoj|czesc)' ,greetings))
   
       


def validate_hello(greetings):
    greetings = greetings.lower()
    return greetings.__contains__('hello') or greetings.__contains__('ciao') or greetings.__contains__('salut') or greetings.__contains__('hallo') or greetings.__contains__('hola') or greetings.__contains__('ahoj') or greetings.__contains__('czesc')

def validate_hello(greetings):
    import re
    return True if re.findall("h[oae]l{1,2}[oa]|ciao|salut|ahoj|czesc", greetings, re.IGNORECASE) else False

import re
def validate_hello(greetings):
    return bool (re.search("hello|ciao|salut|hallo|hola|ahoj|czesc",greetings,re.I))

def validate_hello(greetings):
    hellos = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    for h in hellos:
        if h in greetings.lower():    return True
    return False

import re

def validate_hello(greetings: str) -> bool:
    """ Check if the string contains the word hallo in different languages. """
    return bool(re.search("(hello|ciao|salut|hallo|hola|ahoj|czesc)", greetings, re.I))

def validate_hello(greetings):
    return (any([i for i in ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'] if i in greetings.lower()]))


def validate_hello(greetings):
    if (greetings.upper().find("HELLO") >= 0
        or greetings.upper().find("CIAO") >= 0
        or greetings.upper().find("HALLO") >= 0
        or greetings.upper().find("SALUT") >= 0
        or greetings.upper().find("HOLA") >= 0
        or greetings.upper().find("AHOJ") >= 0
        or greetings.upper().find("CZESC") >= 0):
        return True
    else:
        return False

def validate_hello(greetings):
    hello = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for greeting in hello :
        if greeting in greetings.lower() :
            return True
    return False

def validate_hello(greetings):
    msgs = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'] 
    for msg in msgs:
        if msg in greetings.lower():
            return True
    return False


def validate_hello(greetings):
    d=['hello','ciao','salut','hallo','hola','ahoj','czesc']
    for i in d:
        if i in greetings.lower():
            return True
    return False

import re
def validate_hello(greetings):
    return bool(re.match(r'.*(hello|ciao|salut|hallo|hola|ahoj|czesc).*', greetings, re.I))

def validate_hello(g):
    return any(i.lower() in g.lower() for i in ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'])

import re
def validate_hello(greetings):
    greetings = greetings.lower()
    a = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    for i in a:
        x = re.findall(str(i), greetings)
        if not x:
            pass
        else:
            return True
    return False

def validate_hello(greetings):
    hellos = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    return any(hello in greetings.lower() for hello in hellos)

import re

def validate_hello(greetings):
    return True if re.match(".*(hello|ciao|salut|hallo|hola|ahoj|czesc).*", greetings, re.IGNORECASE) else False

import re

def validate_hello(greetings):
    #print(greetings.lower())
    #print(re.search("[hello|ciao|salut|hallo|hola|ahoj|czesc]", greetings.lower()))
    return True if re.match(".*(hello|ciao|salut|hallo|hola|ahoj|czesc).*", greetings, re.IGNORECASE) else False

import re
def validate_hello(greetings):
    return bool(re.findall(r'h[ae]llo|ciao|salut|hola|ahoj|czesc', greetings.lower()))

def validate_hello(greetings):
    return True if sum(greetings.lower().find(i) for i in ['hello','ciao','salut','hallo','hola','ahoj','czesc']) > -7 else False

def validate_hello(greetings):
    greets = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    text_words = greetings.lower()
    
    return any(i in text_words for i in greets)

def validate_hello(greetings):
    greetings = greetings.lower()
    if 'hello' in greetings or 'hallo' in greetings or 'ciao' in greetings or 'salut' in greetings or 'hallo' in greetings or 'hola' in greetings or 'ahoj' in greetings or 'czesc' in greetings:
        return True
    return False

def validate_hello(greetings):
    greeting = ["hello", "ciao", "salut", "hallo", "hola" ,"ahoj" ,"czesc"]
    t_or_f = ["True" for i in greeting if i in greetings.lower()]
    return "True" in t_or_f

import re


def validate_hello(greetings):
    list_hello = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    greetings2 = (re.sub("[,?!;.:]", "", greetings).lower().split())
    set_A = set(list_hello)
    set_B = set(greetings2)
    return True if set_A.intersection(set_B) != set() else False

def validate_hello(greetings):
    hello_list = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    greetings = greetings.lower()
    
    for hello_str in hello_list:
        if hello_str in greetings:
            return True
    
    return False

s = {'hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'}
def validate_hello(g):
    return any(x in g.lower() for x in s)

def validate_hello(greetings):
    greetings = greetings.lower()
    a = "hello ciao salut hallo hola ahoj czesc"
    a = a.split(" ")
    for x in a:
        if x in greetings:
            return True
    return False

import re
def validate_hello(greetings):
    return bool(re.match(r".*(hello|ciao|salut|hallo|hola|ahoj|czesc).*",greetings,flags=re.IGNORECASE))

import re

def validate_hello(greetings):
    return len(re.findall('hello|ciao|salut|hallo|hola|ahoj|czesc', greetings.lower())) > 0

def validate_hello(g):
    st=['hello','ciao','salut','hallo','hola','ahoj','czesc']
    g=g.lower()
    for i in st:
        if i in g:
            return True
    return False
    
    #your code here


import re
def validate_hello(greetings):
    
    return any([greet in greetings.lower() for greet in 'hello ciao salut hallo hola ahoj czesc'.split()])

import re
def validate_hello(greetings):
    regex = r"(hello|ciao|salut|hallo|hola|ahoj|czesc)"
    return True if re.search(regex, greetings.lower()) else False

def validate_hello(greetings):
    greets = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for i in greets:
        if i in greetings.lower():
            return True

    return False

def validate_hello(greetings):
    greeting = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for s in greeting:
        if s in greetings.lower():
            return True
    return False

def validate_hello(greetings):
    #your code here
    hello_strings = ['hello',
                        'ciao',
                        'salut',
                        'hallo',
                        'hola',
                        'ahoj',
                        'czesc']
    
    return any(s in greetings.lower() for s in hello_strings)

def validate_hello(greetings):
    #your code here
    hello_strings = ['hello',
                        'ciao',
                        'salut',
                        'hallo',
                        'hola',
                        'ahoj',
                        'czesc']
    #return True if (greetings.lower().find(s) != -1) else False for s in hello_strings
    for s in hello_strings:
        if greetings.lower().find(s) != -1:
            return True
    return False

from re import search, IGNORECASE

def validate_hello(g):
    return bool(search("hello|ciao|salut|hallo|hola|ahoj|czesc", g, IGNORECASE))

def validate_hello(g):
    j = ['hello','ciao','salut','hallo','hola','ahoj','czesc']
    return any([x in g.lower() for x in j])

def validate_hello(greetings):
    words = ['ciao', 'hello', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    return any(word in greetings.lower() for word in words)

import string

def validate_hello(greetings):
    HELLO_WORDS = {
        'hello',
        'ciao',
        'salut',
        'hallo',
        'hola',
        'ahoj',
        'czesc'
    }
    return any(x in HELLO_WORDS
                for x in greetings.translate(dict((ord(char), None)
                                    for char in string.punctuation)).lower().split())

def validate_hello(greetings):
    return any([i in greetings.lower() for i in ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']])

def validate_hello(greetings):
    hello = ('hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc')
    return True if any([x in greetings.lower() for x in hello]) else False

greet = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
def validate_hello(greetings):
    return any(w for w in greet if w in greetings.lower())

def validate_hello(greetings):
    return max(i in greetings.lower() for i in ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"])

import re
def validate_hello(greetings):
    return bool(re.search(r"h[ae]llo|ciao|salut|hola!|ahoj|czesc", greetings.lower()))


def validate_hello(greetings):
    hey = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for x in hey:
        if x in greetings.lower():
            return True
    return False

def validate_hello(greetings):
    greeting = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for i in greeting:
            if i in greetings.lower():
                return True
    return False

def validate_hello(greetings):
    #your code here
    hellos=['hello','ciao','salut','hallo','hola','ahoj','czesc']
    greetings=greetings.lower()
    greetings=greetings.split(' ')
    for i in greetings:
        i=i.replace(',','')
        i=i.replace('!','')
        i=i.replace('.','')
        i=i.replace('?','')
        i=i.replace(';','')
        i=i.replace(':','')
        if i in hellos:
            return True
    return False

import re
def validate_hello(greetings):
    return re.search(".*h[ae]llo|ciao|salut|hola|ahoj|czesc", greetings.lower()) is not None

def validate_hello(greetings):
    g=['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    gree=greetings.casefold()
    for i in g:
        if i in gree:
            return True
    return False

def validate_hello(greetings):
    l = ['hello','ciao','salut','hallo','hola','ahoj','czesc']
    return any(i in greetings.lower() for i in l)

def validate_hello(greetings):
    rez = 0
    hell = ["hello","ciao","salut","hallo","hola","ahoj","czesc"]
    for it in greetings.lower().split(" "):
        if "".join(i.lower() for i in it if i.isalpha()) in hell:
            rez += 1
    return True if rez > 0 else False

import re

def validate_hello(greetings):
   return any( w.lower() in {'hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'} for w in re.split('\W', greetings))

def validate_hello(greetings):
    p = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for i in p:
        if i in greetings.lower():
            return True
    return False

import re


def validate_hello(greetings):
    patterns = ["hello", "ciao", "salut", 'hallo', 'hola', "ahoj", 'czesc']
    catcher = re.findall(r'\w+', greetings.lower())
    for i in catcher:
        if i in patterns:
            return True
    return False

def validate_hello(text):
    text = text.lower()
    greetings = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    for hello in greetings:
        if hello in text:
            return True
    return False

def validate_hello(greetings):
    greetings = greetings.lower()
    helloes = ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]
    for hello in helloes:
        if (hello in greetings):
            return True
    return False

def validate_hello(greetings):
    saludos = ["hello","ciao","salut","hallo","hola","ahoj","czesc"]
    for saludo in saludos:
        if saludo in greetings.lower():
            return True
    return False


def validate_hello(greetings):
    item = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    check = False
    for i in item:
        if i in greetings.lower():
            check = True
    return check            

import re

def validate_hello(greetings):
    salute = 'hello|ciao|salut|hallo|hola|ahoj|czesc'
    return bool(re.search(salute, greetings, re.I))    

def validate_hello(greetings):
    hellows = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    greetings = greetings.lower()
    result = False
    for x in hellows:
        if x in greetings:
            result = result or True
    return result

def validate_hello(greetings):
    return any(i for i in ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'] if i in greetings.lower())

def validate_hello(greetings):
    list = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    greetings = greetings.lower()
    for i in list:
        if greetings.find(i)>=0:
            return True      
    return False

import re

def validate_hello(greetings):
    multilingual_greetings = '(hello|ciao|salut|hallo|hola|ahoj|czesc)'
    return len(re.findall(multilingual_greetings, greetings, re.I)) > 0

def validate_hello(greetings):
    b = greetings.lower()
    for a in ["hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"]:
        if a in b:
            return True
    return False

def validate_hello(g):
    mes = ['hello','ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    return 1 in list(g.lower().count(i) for i in mes)
            



def validate_hello(greetings):
    dic = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for i in dic:
        if greetings.lower().find(i) != -1:
            return True
    return False

validate_hello = lambda greetings: any(i in greetings.lower() for i in {'hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc'})

def validate_hello(greetings):
    lista = ['hello','ciao','salut','hallo','hola','ahoj','czesc']
    for i in lista:
        if i.lower() in greetings.lower():
            return True
            
    return False

def validate_hello(greetings: str) -> bool:
    m = greetings.casefold()
    return any(w in m for w in ("hello", "ciao", "salut", "hallo", "hola", "ahoj", "czesc"))


validate_hello=lambda s,d=['hello','ciao','salut','hallo','hola','ahoj','czesc']:any(x in s.lower() for x in d)

def validate_hello(greetings):
    #your code here
    hello = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    greetings = greetings.lower()
    for i in hello :
        if i in greetings : return True
    else : return False

import re
def validate_hello(greetings):
    tpl = r'(?i)(\bhello\b)|(\bhallo\b)|(\bciao\b)|(\bsalut\b)|(\bhola\b)|(\bahoj\b)|(\bczesc\b)'
    return True if re.search(tpl, greetings) != None else False

def validate_hello(greetings):
    #your code here
    hello_list = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for i in hello_list:
        if i in greetings.lower():
            return True
    return False

import re

def validate_hello(greetings):
    print(greetings.lower())

    words = [
    'hello',
    'ciao',
    'salut',
    'hallo',
    'hola',
    'ahoj',
    'czesc',
    ]

    for i in words:
        if bool(re.match('.*'+i+'.*', greetings.lower())):
            return True
    return False        

import re

def validate_hello(greetings):
    pattern = r'(h([ae]llo|ola)|c(iao|zesc)|salut|ahoj)'
    return bool(re.search(pattern, greetings, re.IGNORECASE))

import re

def validate_hello(greetings):
    res=re.search(r'hello|ciao|salut|hallo|hola|ahoj|czesc',greetings,re.IGNORECASE)
    return True if res else False

import re

def validate_hello(greetings):
    return bool(re.findall('h[ae]llo|ciao|salut|hola|ahoj|czesc', greetings, re.I))

def validate_hello(greetings):
    i18n = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    for word in i18n:
        if word in greetings.lower():
            return True

    return False

import re

def validate_hello(greetings):
    return bool(re.search("hello|ciao|salut|hallo|hola|ahoj|czesc", greetings.lower()))

def validate_hello(greetings):
  different_greetings = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
  return any(greeting in greetings.lower() for greeting in different_greetings)

def validate_hello(greetings):
    return bool([1 for x in greetings.translate(greetings.maketrans('', '', '.,!?;:')).lower().split() if x in ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']])

def validate_hello(greetings):
    hellos = ['hello', 'ciao', 'salut', 'hallo', 'hola', 'ahoj', 'czesc']
    return any(greet in greetings.lower() for greet in hellos)


import re
def validate_hello(greetings):
    return bool(re.search('(?i)hello|ciao|hola|hallo|salut|czesc|ahoj', greetings))


import re

def validate_hello(greetings):
    r = 'hello ciao salut hallo hola ahoj czesc'.split()
    return len(re.findall('|'.join(r), greetings, re.I)) > 0