In case you are planned to update tutorial at some point, Isaac pointed me to a cleaner way to calculate mt fraction.
adata.var["mt"] = adata.var_names.str.startswith("MT-")
sc.pp.calculate_qc_metrics(adata, qc_vars=["mt"], inplace=True)
It calculates both total_counts_mt and pct_counts_mt
just leaving it here as reference.