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
I just can't leave well enough alone. Down to 14 lines.
More names, less magic numbers.
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 + "+")
How about:
word = "Almuta$r~id"
predecessors = "_" * 5
successors = "".join(letter for letter in word if letter not in "aiou+~")
for index, letter in enumerate(word):
if letter not in "aiou~+":
next = word[index+1] if index < len(word) - 1 else ""
if next in "aiou":
tail = next
eli
2008/10/15 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>
>
>
> 2008/10/15 John Fouhy <[EMAIL PROTECTED]>
>
>> 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>:
>> > One more question,
>> > I'm a linguistics person, I know some Java and some Python (and failed
>> to
>> > learn Prolog). What thi
2008/10/15 John Fouhy <[EMAIL PROTECTED]>
> 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>:
> > One more question,
> > I'm a linguistics person, I know some Java and some Python (and failed to
> > learn Prolog). What things do I need to learn to write such "difficult"
> > scripts? Are ther
2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>:
> One more question,
> I'm a linguistics person, I know some Java and some Python (and failed to
> learn Prolog). What things do I need to learn to write such "difficult"
> scripts? Are there any recommendations? books, certain things to learn
That's great.
There is still only one thing that I was not aware of when I asked the
question.
When the double consonant sign "~" is there, it should slo be skipped like
the short vowels. In other words, it cannot appear except in the pre-final
position along with another short vowel.
Is that easy
2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>:
> The focus letter will always be # 6 on the line. A is not a short vowel,
> and it is not followed by a short vowel, so the last character should be
> "_", not a "u"
Oh, I see. I misunderstood the meaning of "followed by". I can fix
that
2008/10/15 John Fouhy <[EMAIL PROTECTED]>
> 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>:
> > Dear Tutors,
> > I needed a program to go through a word like this "Almuta$r~id"
> >
> > 1- a, i,u, and o are the short vowels
> > 2- ~ is the double consonant.
> > I wanted the program to d
Dear Tutors,
I needed a program to go through a word like this "Almuta$r~id"
1- a, i,u, and o are the short vowels
2- ~ is the double consonant.
I wanted the program to do the following:
- For each letter of the word, if the letter is not a short vowel, print the
letter with the 5 preceding l
10 matches
Mail list logo