Swaps the values of x and y using arithmetic operations.
(self)
| 57 | self.display_values("After swapping") |
| 58 | |
| 59 | def swap_arithmetic_operations(self): |
| 60 | """ |
| 61 | Swaps the values of x and y using arithmetic operations. |
| 62 | |
| 63 | """ |
| 64 | self.display_values("Before swapping") |
| 65 | self.x = self.x - self.y |
| 66 | self.y = self.x + self.y |
| 67 | self.x = self.y - self.x |
| 68 | self.display_values("After swapping") |
| 69 | |
| 70 | |
| 71 | print("Example 1:") |
nothing calls this directly
no test coverage detected