Replace blanks with letter

eschneider92 at comcast.net eschneider92 at comcast.net
Wed Aug 21 03:49:42 EDT 2013


Thanks. I am running into a bunch of problems with the following code, all of which are clear when running the program

import random
letters='abcdefg' 
blanks='_'*len(letters) 
print('type letters from a to g')
print(blanks)
for i in range(len(letters)):
    if letters[i] in input(): 
        blanks = blanks[:i] + letters[i] + blanks[i+1:]
        print(blanks)

If anyone could post an example of how to correctly code this, I would appreciate it. I can't seem to figure it out.

I'll definitely heed Fabio's advice for future reference, but I don't think it's related to the problems I'm currently experiencing. If it is, and I'm just not getting it (most likely the case), please post an example of how to implement his code advice in doing what I wish to accomplish here.



More information about the Python-list mailing list