Third implementation #13 (intermediate) Python