MCPcopy Create free account
hub / github.com/geekcomputers/Python / swap_arithmetic_operations

Method swap_arithmetic_operations

swap.py:59–68  ·  view source on GitHub ↗

Swaps the values of x and y using arithmetic operations.

(self)

Source from the content-addressed store, hash-verified

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
71print("Example 1:")

Callers

nothing calls this directly

Calls 1

display_valuesMethod · 0.95

Tested by

no test coverage detected