I am creating a code which checks a user inputted password and gives points based on it. One of the points is: If it has 3 letters adjacent/consecutive on the QWERTY UK keyboard then it will be -5 points. e.g "qwerty" will be -20 points for "qwe" "wer "ert" "rty". I have got a solution to this but I was wondering if there is any way of improving it.
input = input("What is your password?") qwerty = 'qwertyuiopasdfghjklzxcvbnm' lower = input.lower() for idx in range(0, len(lower) - 2): test_seq = lower[idx:idx + 3] if test_seq in qwerty: points -= 5 print(points)