Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52753
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-08-21 00:49 -0700 |
| References | <2bdbd16f-a676-4973-9866-db93b1b9cd9b@googlegroups.com> |
| Message-ID | <89146bb1-fb60-4746-93e2-6cb59cfbc432@googlegroups.com> (permalink) |
| Subject | Re: Replace blanks with letter |
| From | eschneider92@comcast.net |
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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Replace blanks with letter eschneider92@comcast.net - 2013-08-20 01:35 -0700
Re: Replace blanks with letter Fábio Santos <fabiosantosart@gmail.com> - 2013-08-20 10:16 +0100
Re: Replace blanks with letter Peter Otten <__peter__@web.de> - 2013-08-20 11:19 +0200
Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-20 13:45 -0700
Re: Replace blanks with letter Dave Angel <davea@davea.name> - 2013-08-20 21:54 +0000
Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-21 00:49 -0700
Re: Replace blanks with letter Chris Angelico <rosuav@gmail.com> - 2013-08-21 19:24 +1000
Re: Replace blanks with letter Dave Angel <davea@davea.name> - 2013-08-21 11:42 +0000
Re: Replace blanks with letter John Gordon <gordon@panix.com> - 2013-08-21 14:35 +0000
Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-22 15:42 -0700
Re: Replace blanks with letter Dave Angel <davea@davea.name> - 2013-08-23 01:28 +0000
Re: Replace blanks with letter eschneider92@comcast.net - 2013-08-22 15:44 -0700
csiph-web