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.

1st Jun 2020, 1:31 AM
Nigel George
Nigel George - avatar
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()
1st Jun 2020, 1:38 AM
Emanuel Maliaño
Emanuel Maliaño - avatar
0
Thanks much. It is working now. Have a blessed day
1st Jun 2020, 1:42 AM
Nigel George
Nigel George - avatar