def GetMemory(title, FSB1, FSB2, FSB3, Rover):
    word = raw_input("Enter the number of words you want to allocate: ")
    print "GET_MEMORY IS RUNNING......."
    print "Initial FSB list"
    Print (title, fsb1, fsb2, gsb3, rover)
    if int(word) <= fsb1[2]:  # Size of area being returned
        fsb[2] = fsb[2]-int(word)
        fsb[1] = fsb[1]+int(word)
        rover = fsb2[1]
        print "Allocation request for " + word + " words"
        print "Allocation was successful"
        print "Allocation was in location " + str(fsb1[1]-int(word))
        print(title, fsb1, fsb2, fsb3, Rover)
    elif int(word) <= fab2[2]:
        fab2[2] = fsb2[2] - int(word)
        fsb2[1] = fab2[1] + int(word)
        rover = fsb3[1]
        print "Allocation request for"+words+" words"
        print "Allocation was successful"
        print "Allocation was in location" +str(fsb2[1] - int(word))
        print(title, fsb1, fsb2, fsb3, Rover)
    elif int(word) <= fab3[2]:
        fab2[2] = fsb3[3] - int(word)
        fsb2[1] = fab3[1] + int(word)
        rover = fsb3[1]
        print "Allocation request for"+words+" words"
        print "Allocation was successful"
        print "Allocation was in location" +str(fsb2[1] - int(word))
        print(title, fsb1, fsb2, fsb3, Rover)
    else:
        print"Allocation request for 150 words" +words+" words"
        print"Allocation was not successful"
        print" . "
        print" . "
        print" . "
        print"_____________________________________________________"
        print"_____________________________________________________"


def FreeMemory(title, FSB1, FSB2, FSB3, Rover):
    word = raw_input("Enter the number of words you want to de-allocate: ")
    location = raw_input("Enter location")
    print "FREE_MEMORY IS RUNNING......."
    print "Initial FSB list"
    Print (title, fsb1, fsb2, gsb3, rover)
    if int(location) = fab1(1):
        fab1(1) = int(location)
        fab1(2) = fab1(2)+int(word)
        print "De-Allocation request of "+words+" words at location" +location
    elif int(location) = fab1(1):
        fab2(1) = int(location)
        fab2(2) = fab1(2)+int(word)
        print "De-Allocation request of "+ words+" words at location" +location
    elif int(location) = fab3(1):
        fab2(1) = int(location)
        fab2(2) = fab1(2)+int(word)
        print "De-Allocation request of "+ words+" words at location" +location
        print (title, fsb1, fsb2, fsb3, rover)
    else: 
        print"De-Allocation request for 150 words" +words+" words"
        print"De-Allocation was not successful"
        print" . "
        print" . "
        print" . "
        print"_____________________________________________________"
        print"_____________________________________________________"

def Display(title, fsb1, fsb2, fsb3, Rover):
    print " "join(title)
    print fsb1
    print fsb2
    print fsb3
    print "Rover is " +str(rover)
    print"______________________________________________________________"

def main():
    title = ['FSB#', 'Location', 'Size']
    fsb1 = {1, 7, 4}
    fsb2 = {2, 14, 10}
    fsb3 = {3, 30, 20}
    Rover = 14
    getMemory(title, fsb1, fsb2, fsb3, Rover)
    FreeMemory(title, fsb1, fsb2, fsb3, rover)
main()





# So for some typo or some reason this is not working any help would be appreciated

I can see several problems with this code.

  1. Your print statements are all over the place. You can't have print"hello" with no space. If you are using Python 2.x, use print "hello" (with the space) or if you using python 3.x use print("hello") with brackets. You can use the second way in python 2.7, but I don't see the point.

  2. Case is important in Python. FSB1 is different to fsb1. You've done that with print to. Print is different to print.

  3. In FreeMemory, you've got cases where your calling a function: fabs1(1) where I think you should be indexing fabs1[1].

  4. In display, you go " "join(title). join is a function of a string object, it should be " ".join(title).

Those are the onesthat I found by skimming.

This article has been dead for over six months. Start a new discussion instead.