a = 100
b = 200
print(before 'swap: a = ', a, 'b = ', b)
temp = a
a = b
b = temp
print (after 'swap: a = ', a, 'b = ', b)
'''
Result------------------------------------------------------------------------
Before swap: a = 100 b = 200
After swap: a = 200 b = 100
'''
Can an integer be assigned to an integer? (a=b part)
python swap
© 2024 OneMinuteCode. All rights reserved.