Root Finding Algorithm Python Code