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.
d = {'L': 0, 'U': 0, 'N': 0, 'S': 0}
l, u, t, s = 1, 1, 1, 1
for i in password:
if i in string.ascii_lowercase:
d['L'] = l
l += 1
if i in string.ascii_uppercase:
d['U'] = u
u += 1
if i in string.digits:
d['N'] = t
t += 1
if i in string.punctuation:
d['S'] = s
s += 1
chars = len([v for k, v in d.items() if v == 0])
if (n + chars) < 6:
return 6 - n
else:
return chars
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Strong Password
You are viewing a single comment's thread. Return to all comments →
import string
def minimumNumber(n, password):