I'm guessing that what you actually want is two loops, one for waiting until they guess right, and one for gathering their guess:
words = ['a', 'b', 'c', 'd']
code = ['3' , '2', '4' , '9']
guess = None
while guess != words:
print 'Enter 4 number/letter pairs'
guess = code
for i in range(4):
number = raw_input("Enter a number: ")
letter = raw_input("Enter the letter: ")
guess = list(map(lambda x: str.replace(x, number, letter), guess))
if guess == words:
print 'You got it!'
else:
print 'Nope! Guess again!'
This way the guess is reset each time. If you don't do that, then after 4 times the working list for the code (guess in my code here) might be something like this:
>>> print guess
['3', 'd', 'y', '9']
If it looks like this, then to fix it, they would have to enter a letter/letter pair, rather than a number/letter pair. To make things worse, you could even have it get into a state where it becomes impossible to get it right. For example, if guess looks like this:
['3', 'a', 'a', '9']
If you try to change one of the 'a's to anything else, then the other 'a' will change as well. Seeing as the result you're trying to get has them as being different, then there is no way to get the correct result from this guess.
If you really do want each guess to carry on until the user gets it all correct, I'd suggest a different strategy:
words = ['a', 'b', 'c', 'd']
code = ['3' , '2', '4' , '9']
mapping = {}
guess = None
while guess != words:
number = raw_input("Enter a number: ")
letter = raw_input("Enter the letter: ")
mapping[number] = letter
guess = [mapping.get(entry, entry) for entry in code]
print 'You got it!'
This strategy will overwrite any previous guess and effectively make it so they are always working with the original code.
Whatever strategy you choose, it would probably be a good idea to give the user some idea of what they've already guessed. In my second example, you could print out the mapping (in some nice format). Here's an idea for how you could print it:
print '\n'.join('%s->%s' % (number, letter) for number, letter in sorted(test.items(), key=lambda x: x[0]))
This would print {'1': 'a', '3': 'c', '2': 'b'} like this:
1->a
2->b
3->c
while words != code: #do something???codelist? You are assigning it to some unspecified thing calledGuessabove. Maybewhile words != Guess? Or maybe tell us more about what you are doing?