I'm trying to solve a problem I already solved before but now using list comprehensions. The problem is simple I have a list and I want to invert it using list comprehension
Defining the first list was easy but when I append the inverted list it gives me the error in the title. I know we should not append in list comprehensions but I don't know what to put.
v=[]
p=[]
def listt():
v=[int(input('Digit element\n'))for j in range(0,int(input('Digit number of elements')))]
return v
print(listt())
def invert_list(v):
p=[p.append(v[j]) for j in range(len(v),-1,-1)]
return p
print(invert_list(v))