[Tutor] Planning a program with algorithm?
. ,
administrata at hotmail.com
Sun May 29 21:21:33 CEST 2005
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/
More information about the Tutor
mailing list