[Tutor] Difficult loop?
bob gailer
bgailer at gmail.com
Thu Oct 16 17:47:52 CEST 2008
Last post for this assignment for now - simplified even more.
word = "Almuta$r~id"
window = position = 5
shortAndOmit = "aiou+~"
rest = "_" * window + "".join(letter for letter in word
if letter not in shortAndOmit) + "_" * window
word = iter(word)
for letter in word:
if letter not in shortAndOmit:
position += 1
print rest[position-window:position+window+1] + "_"
elif letter in shortAndOmit[:4]:
print rest[position-window:position+window+1] + letter
elif letter == "~":
print rest[position-window:position+window+1] + "~" + word.next()
--
Bob Gailer
Chapel Hill NC
919-636-4239
When we take the time to be aware of our feelings and
needs we have more satisfying interactions with others.
Nonviolent Communication provides tools for this awareness.
As a coach and trainer I can assist you in learning this process.
What is YOUR biggest relationship challenge?
More information about the Tutor
mailing list