swap_two_variables

PHOTO EMBED

Wed May 19 2021 18:24:48 GMT+0000 (UTC)

Saved by @DeployFriday #python

# Solution with a temporary variable

a = input("Enter variable a: ")
b = input("Enter variable b: ")

print(f"Variable a is {a}: ")
print(f"Variable b is {b}: ")

c = a
a = b
b = c

print(f"Variable a is now {a}: ")
print(f"Variable b is now {b}: ")
content_copyCOPY

swap two variables with temporary variable