I just started self-learning Python and I stumble a sorting activity base on user input.
This is the code:
a = int(input("Enter Num1:"))
b = int(input("Enter Num2:"))
c = int(input("Enter Num3:"))
d = int(input("Enter Num4:"))
if a > b: b, a = a, b
if b > c: c, b = b, c
if c > d: d, c = c, d
if a > b: b, a = a, b
if b > c: c, b = b, c
if a > b: b, a = a, b
print(d, c, b, a)
I have a basic knowledge in if-else statement
but I'm lost on what happened in this line if a > b: b, a = a, b
. Please explain it to me. Thank you