Update ex26.py

removed some bugs from the code.