Python Code updated