Newbie data structes question

Kamus of Kadizhar yan at NsOeSiPnAeMr.com
Thu Dec 4 06:34:01 EST 2003


I have never programmed anyting in python, so this is completely new 
territory.  I've programmed in C for so long it's pretty hard wired in 
my brain.  I'm trying to break out :-)

I have a program in mind that I think would be a good learning project.

I have a machine that shows movies.  There are favorites (most often 
watched movies) that are kept on the machine and archives that are kept 
on an NFS server.  There are also new arrivals.  All movies (new 
arrivals, favorites, etc) are in the archives.

The machine logs movie names of all movies played.  The log file is 
simply a list of movie titles played.  If a movie has been played 10 
times, it will appear in the list 10 times.

I want to write a script that will automatically move most watched 
movies into favorites, delete movies that are no longer favorites, and 
replace them with movies that are more frequently watched from archives.

So, I have to create a paired list of some sort:

(movie, count), (movie, count), (movie, count) ....

sort the list on the counts, and then loop through from most often 
watched movie not in favorites replacing it in the favorites list with 
the least often watched movie in the favorites list.  Stop looping when 
the watch count for both in favorites and not in favorites is the same.

If any movies put in to the favorites were in the new arrivals, delete 
from new arrivals.

So, here's my python question:

What data structures and flow controls are most appropriate?  Any neat 
flow control in python?

Thanks,

-Kamus

-- 
What am I on?
I'm on my bike,                         o__
6 hours a day, busting my ass.          ,>/'_
What are you on? --Lance Armstrong     (_)\(_)





More information about the Python-list mailing list