[Tutor] Planning a program with algorithm?

Pujo Aji ajikoe at gmail.com
Sun May 29 21:56:31 CEST 2005


Before you write algorithm it is always good to know every aspect of
the programing language you will use.

python has built in function like set, data like list, dictionary,
style like list comprehension, lambda etc.... that worth knowing
before you start to write algorithm.

It is always good to write program as soon as you have in my mind. in
old program paradigm sometimes we needs planning, python makes it
possible to do less planning because it is less typing language with
battery included style. sometimes python code is more clear than the
algorithm.....  : )

About planning bigger project, I suggest you use extreme programming
style (like refactoring etc,), since good program sometimes needs you
to change your code quiet often.

pujo

On 5/29/05, . , <administrata at hotmail.com> wrote:
> I know how to write a prog.
> 
> But, I don't know how to plan a prog. with algorithm.
> 
> If algorithm of a part of a prog. is like..
> -------------------------------------------------------------------------------------------------------------------------------------------
> create an empty jumble word
> while the chosen word has letters in it
>     extract a random letter from the chosen word
>     add the random letter to the jumble word
> -------------------------------------------------------------------------------------------------------------------------------------------
> 
> It would be like..
> -------------------------------------------------------------------------------------------------------------------------------------------
> jumble = ""
> while word:
>     position = random.random(len(word))
>     jumble += word[position]
>     word = word[:position] + word[(position+1):]
> -------------------------------------------------------------------------------------------------------------------------------------------
> 
> 
> If the prog. is like..
> -------------------------------------------------------------------------------------------------------------------------------------------
> #Game List
> 
> list = ("GT4",
>          "GTA Sanandreas",
>          "Takken 5")
> 
> print "My Games: "
> for i in list:
>    print i
> 
> print "\nI've got", len(list), "games."
> 
> add = raw_input(\n\nAdd more games: ")
> adding = (add)
> list += adding
> 
> print "Total games are..."
> print list
> 
> raw_input("exit.")
> -------------------------------------------------------------------------------------------------------------------------------------------
> 
> What would the algorithm be for the prog.?
> 
> Any useful advice for algorithm would be appreciated.
> 
> Thanks.
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list