import random import time DEF Login (): for Frequency in Range (. 3 ): # generate a combined list of letters + numbers num_lst = [I for I in Range (10 )] [num_lst.append (CHR (J)) for J in Range (97,123 )] # random.sample (List, NUM) list, the number of bits in the six-digit random list RET = random.sample (num_lst, 6 ) Print (ret) NUM = List (INPUT ( ' Please enter this code: ' )) IF [STR (X) for X in RET] == [STR (Y) for Y in NUM]: Print ( " successful login " ) BREAK the else : Print ( ' Login failed ' ) IF Frequency == 1 : Print ( ' You have one more chance to enter, or they will lock 5 seconds ' ) the else : time.sleep(5) login()