Python Code
Result