Trying to add max key to dictionary in another dictionary Error
Question: I am trying to add the max key of the first dictionary in a second but when I
run it shows me a syntax error for `sack{}`. And I can't seem to figure out
why this error occurs. Could anyone explain what the error is? Thank you.

The Code is as below:

    
    
    #!/usr/bin/python3
    import sys
    
    def vault(dataFile):
        gem = []
        weight = []
        value = []
        valPerCarat = []    
        for l in dataFile.readlines():      
            attribute = l.split(",")
            gem.append(str(attribute[0]))
            weight.append(float(attribute[1]))
            value.append(int(attribute[2]))
            valPerCarat.append(int(attribute[2])/float(attribute[1]))
        booty = theft_preparation(gem, valPerCarat)
        return (booty)  
    
        #return(gem, weight, value, valPerCarat)
    
    def theft_preparation(gem, valPerCarat):
        loot = dict(zip(gem, valPerCarat)
        sack = {}
        precious = 0
        while (precious =< 5.00):
            max (loot, key=loot.get)
            precious = dict.get(key, default=None)
            precious +=precious
            sack.update(key)        
            del(key)
    
        return (sack)
    
    
    def main():
        fileFound = False
        while not fileFound:
            fileName = input("File name containing jewel data: ")
            try:
                dataFile = open(fileName, "r")
                fileFound = True
    
            except:
                print("Could not find that file -- try again")
        knapsackCapacity = 5.00 
        print (vault(dataFile))
    
    
    main()
    


Answer: You are missing a closing parenthesis on the previous line:

    
    
    loot = dict(zip(gem, valPerCarat)
                                     ^ HERE
    

