0
Print function not printing anything
Hi guys I'm trying to reverse my list here using a function. I don't know why my code isn't working. See the code below: L=[1, 2,3,4] def rev() : L.reverse() print(L) #The code is running but not printing the reversed list. Please help.
2 Answers
+ 1
you need to call the function at the end
L = [1, 2, 3, 4]
def rev():
L = L.reverse()
print(L)
rev()
0
Thanks much. It is working now. Have a blessed day