Re: [Tutor] swapping list elements based on some criterion

2011-10-08 Thread عمـ نوفل ـاد
Hi Steven ans Tutors, Thanks for the code. Actually I'm not a student at all. I'm an assistant professor of Arabic at Suez Canal University in Egypt. I would appreciate more contributions from you and the other list members. 2011/10/8 Steven D'Aprano st...@pearwood.info Emad Nawfal (عمـ نوفل

Re: [Tutor] swapping list elements based on some criterion

2011-10-08 Thread عمـ نوفل ـاد
2011/10/8 Emad Nawfal (عمـ نوفل ـاد) emadnaw...@gmail.com Hi Steven ans Tutors, Thanks for the code. Actually I'm not a student at all. I'm an assistant professor of Arabic at Suez Canal University in Egypt. I would appreciate more contributions from you and the other list members. 2011

Re: [Tutor] swapping list elements based on some criterion

2011-10-08 Thread عمـ نوفل ـاد
On Sat, Oct 8, 2011 at 12:11 PM, Andreas Perstinger andreas.perstin...@gmx.net wrote: On 2011-10-08 09:53, Peter Otten wrote: Emad Nawfal (عمـ نوفل ـاد) wrote: Here is the function as I used it, and it works fine: def swap(sentence): buffer = [] adjectives = [] for word

Re: [Tutor] swapping list elements based on some criterion

2011-10-08 Thread عمـ نوفل ـاد
On Sat, Oct 8, 2011 at 12:34 PM, Andreas Perstinger andreas.perstin...@gmx.net wrote: On 2011-10-08 11:11, Andreas Perstinger wrote: def swap(sentence): s = sentence.split() for i in reversed(range(len(s))): if s[i].endswith(/N) and s[i-1].endswith(/ADJ):

[Tutor] swapping list elements based on some criterion

2011-10-07 Thread عمـ نوفل ـاد
Hello Tutors, It's been quite some time since I last posted something here, and now I'm back with a question: I want to re-structure English so that the adjectives appear after the nouns, instead of before. If I have a sentence like: The tall man plays well I need to change it to The man tall

Re: [Tutor] Medical Decision-Making Question

2011-06-13 Thread عمـ نوفل ـاد
On Mon, Jun 13, 2011 at 5:22 PM, Fred G bayespoker...@gmail.com wrote: Hello-- I'm a pre-med student interested in decision-making as applied to medical decisions. I am trying to build a medical decision-making algorithm and am pretty stuck on a few things. I've built a file that contains

Re: [Tutor] help

2011-02-24 Thread عمـ نوفل ـاد
On 2/24/11, Chris Schiro cschiro...@gmail.com wrote: Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact

Re: [Tutor] split a 5 chars word into 4 and 1

2010-03-09 Thread عمـ نوفل ـاد
On Tue, Mar 9, 2010 at 10:31 AM, Rafik Ouerchefani rouerchef...@gmail.comwrote: Hello, I'm trying to split 5 chars words (codes) into 2 variables. The first must contain the first 4 characters. The second variable will only contain the last character. I'm working in a loop pre-generated

Re: [Tutor] split a 5 chars word into 4 and 1

2010-03-09 Thread عمـ نوفل ـاد
On Tue, Mar 9, 2010 at 11:03 AM, Stefan Behnel stefan...@behnel.de wrote: Emad Nawfal (عمـ نوفل ـاد), 09.03.2010 16:45: What about indexing part1 = word[:4] That's slicing. part2 = word[4] That's indexing. Stefan Thanks Stefan

Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread عمـ نوفل ـاد
On Fri, Mar 5, 2010 at 1:03 PM, Wayne Werner waynejwer...@gmail.com wrote: On Fri, Mar 5, 2010 at 11:56 AM, Rüdiger Wolf rudiger.w...@throughputfocus.com wrote: Hi I am trying to Process list elements as consecutive pairs into consecutive pairs. Any pythonic suggestions? listin =

Re: [Tutor] Rép. : How can I make this run fast er?

2009-12-22 Thread عمـ نوفل ـاد
Nawfal (عمـ نوفل ـاد) emadnaw...@gmail.com* a écrit : De: Emad Nawfal (عمـ نوفل ـاد) emadnaw...@gmail.com Objet: [Tutor] How can I make this run faster? À: tutor Tutor@python.org Date: lundi 21 Décembre 2009, 8 h 40 Dear Tutors, The purpose of this script is to see how many vocalized forms

[Tutor] How can I make this run faster?

2009-12-21 Thread عمـ نوفل ـاد
Dear Tutors, The purpose of this script is to see how many vocalized forms map to a single consonantal form. For example, the form fn could be fan, fin, fun. The input is a large list (taken from a file) that has ordinary words. The script creates a devocalized list, then compares the two lists.

Re: [Tutor] How can I make this run faster?

2009-12-21 Thread عمـ نوفل ـاد
2009/12/21 Alan Gauld alan.ga...@btinternet.com Emad Nawfal (عمـ نوفل ـاد) emadnaw...@gmail.com wrote def devocalize(word): vowels = aiou Should this include 'e'? return .join([letter for letter in word if letter not in vowels]) Its probably faster to use a regular expression