We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
if s.count('@') != 1 or s.count('.') != 1 or s.count('@')< 1 or s.count('.')< 1: return False
try:
un = lambda s: s.split('@')[0],
web = lambda s: s.split('.')[0],
ext = lambda s: s.split('.')[1]
except:
return False
except:
if lambda s: s.find('.') 3): return False
if lambda s : not all((c.isalnum() or c=='_' or c=='-') for c in un(s)) : return False
if lambda s: not web(s).isalnum() : return False
if lambda s: not ext(s).isalpha() :return False
finally:
return True
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Validating Email Addresses With a Filter
You are viewing a single comment's thread. Return to all comments →
if s.count('@') != 1 or s.count('.') != 1 or s.count('@')< 1 or s.count('.')< 1: return False try: un = lambda s: s.split('@')[0], web = lambda s: s.split('.')[0], ext = lambda s: s.split('.')[1] except: return False except: if lambda s: s.find('.') 3): return False
finally: return True