How to reverse an array:
a ="ApplePie" print("Reverse is", a[::-1])
Output:
Reverse is eiPelppA
How to swap two values:
x, y = 10, 20 print(x, y) x, y = y, x print(x, y)
Output:
10 20 20 10
How to reverse an array:
a ="ApplePie" print("Reverse is", a[::-1])
Output:
Reverse is eiPelppA
How to swap two values:
x, y = 10, 20 print(x, y) x, y = y, x print(x, y)
Output:
10 20 20 10