Can Someone Please Solve The Question Using Python

Can Someone Please Solve The Question Using Python