Solving Mathematical Operations In Python