variance of a portfolio with n assets

python write list to file without brackets