the python code for sample and practise