Well, that's definitely not runnable example, but anyway.
The problem is that you have different number of undescores in the blanks and in the questions. They are different even between different elements in blanks:
e.g. ___1___ and __1__ (first is whit three, and in the question is with two)
__4__ (only two underscores)
and as a side note, in your case minimal runnable code snippet would be
The problem is that you have different number of undescores in the blanks and in the questions. They are different even between different elements in blanks:
e.g. ___1___ and __1__ (first is whit three, and in the question is with two)
__4__ (only two underscores)
and as a side note, in your case minimal runnable code snippet would be
blanks = ["___1___","___2___","___3___", "__4__"] blanks_index = 0 quiz = '''Python is an __1__ oriented __2__ programming language that has become very popular. It was created by __3__ Van Rossum.Python has been used widely, especially for __4__ learning.''' replaced_quiz = quiz.replace(blanks[blanks_index], 'object'.upper()) #This should replace the blanks with the user-answer, why is is not working??? :( print replaced_quiz
Output:Python is an __1__ oriented __2__ programming language that has become very popu
lar. It was created by __3__ Van Rossum.Python has been used widely, especially
for __4__ learning.