Hi guys!

I am trying to create a strategy, which would sort stocks by their market cap, by choosing only top 20% of them. I've been following a simmilar code which I found in tutorials, regarding the “book-to-Market Value Anomaly”, by adjusting it to my strategy.
https://www.quantconnect.com/tutorials/strategy-library/book-to-market-value-anomaly
Unfortunately after running my code i get this error "

Runtime Error: property is read-only
  at FineSelectionFunction
    i.MarketCap = float(i.MarketCap)
   at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.Dispatcher.TrueDispatch(Object[] args)
   at Python.Runtime.Dispatcher.Dispatch(Object[] args)
   at __System_Func`2\[\[System_Collections_Generic_IEnumerable`1\[\[QuantConnect_Data_Fundamental_FineFundamental\ in main.py: line 40

Do you know what could be causing this? And do you see any other issues in my code, which I could be facing in the near future?

     def CoarseSelectionFunction(self, coarse):
        ''' Drop stocks which have no fundamental data or have low price '''
        return [x.Symbol for x in coarse if x.HasFundamentalData and x.Price > 5]

    def FineSelectionFunction(self, fine):
        ''' Selects the stocks by lowest market cap '''
        sorted_market_cap = sorted([x for x in fine if x.MarketCap > 0],
            key=lambda x: x.MarketCap)

        for i in fine:
            i.MarketCap = float(i.MarketCap)
        top_market_cap = sorted(fine, key = lambda x:x.MarketCap, reverse=True)[:int(len(fine)*0.2)]
        self.sorted_by_mc = [i.Symbol for i in top_market_cap] 
        total_market_cap = np.sum([i.MarketCap for i in top_market_cap])
        self.weights = {}
        for i in top_market_cap:
            self.weights[str(i.Symbol)] = i.MarketCap/total_market_cap
        return self.sorted_by_mc

Author