Hi i am new at python,i am getting problem in the above code,the problem reads as follows:
Having several accounts on several servers, one has to remember many passwords. You can imagine a situation where someone forgets one of them and he or she only remembers that it consisted of certain words and digit combinations. For example, one might remember that the password likely consisted of words x, y and z, and had digits between the words. That is: <word><digit><word><digit><word>. There might also be cases where there are multiple possible words, but the user is sure he or she only used 1 of them in the password.
Your task is to write a program which will generate all possible passwords from a given dictionary and set of rules. For the example given above the dictionary contains three words: x, y, z, and the rule is given as #0#0# which stands for <word><digit><word><digit><word>.
First line contains a number of words in the dictionary (n). The words themselves are given in n consecutive lines. The next line contains the number of rules (m). Similarly consecutive m lines contain rules. Each rule consists of characters `#' and `0' given in arbitrary order. The character `#' stands for a word from the dictionary, whilst the character `0' stands for a digit.
Input data may contain many sets of dictionaries with multiple rules attached to them.
For each set of dictionary and rules you should output two hyphens followed by a linebreak and all matching passwords given in consecutive lines. Passwords should first be output in rule order. That is, all passwords for rule 1 should be output first, followed by passwords for rule 2 etc. Within each set of passwords, the passwords should be ordered. 2 rules apply: digits must be numerically ascending; words should be in the order they were listed in the dictionary.
Assumptions: The number of words in the dictionary is greater than 0 and smaller or equal to 100 (0 < n ≤ 100). Length of the word is greater than 0 and smaller than 256. A word may contain characters `A'..`Z',`a'..`z',`0'..`9'. The number of rules is smaller than 1000, and a rule is shorter that 256 characters. The character `0' may occur in the rule no more than 7 times, but it has to occur at least once. The character `#' is not mandatory meaning that rules containing no '#' can occur.
A code snippet is working code! Do not paste your homework problems here!