Update advanced.py

added comments to the code - so you know what they are used for and it will be helpful for us in the VIVA