Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52727
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-08-20 01:35 -0700 |
| Message-ID | <2bdbd16f-a676-4973-9866-db93b1b9cd9b@googlegroups.com> (permalink) |
| Subject | Replace blanks with letter |
| From | eschneider92@comcast.net |
I'm trying to replace the blank(_) with the letter typed in by the user, in the appropriate blank(_) spot where the letter should be (where is in the letters list).
letters='abcdefg'
blanks='_ '*len(letters)
print('type letter from a to g')
print(blanks)
input1=input()
for i in range(len(letters)):
if letters[i] in input1:
blanks = blanks[:i] + letters[i] + blanks[i+1:]
What am I doing wrong in this code?
Thanks
Eric
Back to comp.lang.python | Previous | Next — 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