Did loop but it did not work said 'unsupported operand type'