Swaps the values of x and y using a temporary variable.
(self)
| 46 | self.display_values("After swapping") |
| 47 | |
| 48 | def swap_temp_variable(self): |
| 49 | """ |
| 50 | Swaps the values of x and y using a temporary variable. |
| 51 | |
| 52 | """ |
| 53 | self.display_values("Before swapping") |
| 54 | temp = self.x |
| 55 | self.x = self.y |
| 56 | self.y = temp |
| 57 | self.display_values("After swapping") |
| 58 | |
| 59 | def swap_arithmetic_operations(self): |
| 60 | """ |