Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Python Programming/Password checker

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

The basic premise of a password checker is to check passwords... sounds simple enough, right? Just basic string analysis. But recently I have been issued a challenge to make sure the string doesn't contain any consecutive letters on a qwerty keyboard (see bottom of page). I have just completed the basic premise and come up with this code: password = input('password:') rows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] for r in range rows: for i in range(len(password)): for j in range(len(r)): if rows[j:j+2] == password[i:i+2]: print('NO' + password[i:i+2]) # Here you need to change it to an appropriate error message Hope this helps everyone else on a now advanced password checker! just FYI, qwerty keyboards are: q w e r t y u i o p a s d f g h j k l z x c v b n m