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?


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to