I'm not really to sure with using python and its object oriented features as Im better with java.

Im not sure whether to put the functions inside the classes as i can't really seeing this making a difference. I will apply my code and any changes or guidence would be great (just to be told if im on the right path etc)

def main():
    user = menu(username)
   
    class Film(object):

        def __init__(self, year, fans):
            self.year = year
            self.fans = fans
    

    class Drama(Film):

        def __init__(self, film, director, actor):
            Film.__init__(self, year, fans)
            self.film = film 
            self.director = director
            self.actor = actor
            self.year = year
            self.fans = fans

    class Documentary(Film):

        def __init__(self, narrator, subject, year, fans):
            Film.__init__(self, year, fans)
            self.narrator = narrator
            self.subject = subject

def menu(userName)

    print "Hello, welcome."
    userName = raw_input("What is your name?: ")
    while exit = 0
        print "Please select an option. 1. Add a Film 2. List Films 3. Find film by release date"
        inputCommand = input("Enter here: ")
        if inputCommand == 1
            filmType = input("Press 1 for Drama . Press 2 for Documentary: ")
            if filmType == 1
                addDrama(film, director, actor, year)
            else
                addDoc(narrator, subject, year)
        elif inputCommand == 2
            listFilms(film, director, actor, year)
        elif inputCommand == 3
            releaseDate(year)
        elif inputCommand == 8
            exit = 1
             
    
def addDrama(film, director, actor, year):
            film = raw_input("Enter name of film: ")
            director = raw_input("Enter name of director: ")
            actor = raw_input("Enter name of actor: ")
            year = input("Enter year of film: ")
            filedata
            file = open("database.txt", "w")
            dram = Drama(film, director, actor, year)
            file.write(film, director, actor, year)
            file.close()

def addDoc(narrator, subject, year):
            narrator = raw_input("Enter name of narrator: ")
            subject = raw_input("Enter subject of documentary: ")
            year = input("Enter year of film: ")
            filedata
            file = open("database.txt", "w")
            doc = Documentary(narrator, subject, year)
            file.write(narrator, subject, year)
            file.close()

No, you should never be declaring classes inside a function... Your class definitions should go out on the main level and then call them from within the functions...

Also, get rid of your calls to input as it's not safe. You should always use raw_input and then convert to a numerical object. How about you try firing up your interpreter and use input() then type in 4 * 5 + 10 ... It's a flaw that is being removed in Python 3.0

commented: good advice +6
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.