Exercise 5 · Chapter: VariablesRequired+50 XP
Swap Values
You are given two variables. Swap their values and print both.
Your output should be:
a = 10 b = 5
Hint: You'll need a third variable to hold one value while you swap!
Need a hint?
3 available · costs 5 XP each
python
a = 5
b = 10
# Swap the values of a and b
print("a =", a)
print("b =", b)
Output
Run your code to see the output here.