Hopelessly Lost And Desperate Newbie

Afgncaap5 afgncaap5 at aol.com
Thu Dec 4 09:26:05 EST 2003


Hello, there.  I'm desperately in need of assistance, because I can't figure
out how to get Python to work.  Could someone help me with a program that can
examine textual input in pairs of letters, keep track of how often the letters
occur, and then write a random letter generator based on that input, do you?

I mean,....well, let's say that this thing (in its most primitive state) would
just count the occurances of a single letter. From the input, "a" occurs 12
times, "z" occurs 3 times, "q" occurs once, "e" occurs fifteen times, etc.

Second level up, it would look at pairs of letters. It would know that "qu"
occurs much more frequently than "qa", "re" occurs more than "ry", etc.

The final level up, the one that I'm quite frankly not concerned with just yet,
would look at triads of letters. "que" occurs more frequently than "qut", "qat"
occurs more than "qab", etc.

And then the random letter generator would use these letter frequencies to
determine which letter to create next.

It starts with the letter "q", checks its records, and notes that "qu" is much
more frequently encountered than "qa", so it probably prints "qu" next. Then it
sees that "up" occurs more than "ue", so it most likely prints "qup" instead of
"que."

Does this make sense, or am I rambling?

Sorry for being so dense, but while I can get some of the stuff in all of the
Python tutorials, there are a few things that I'm still having trouble even
getting started with.




More information about the Python-list mailing list