-4
The following code gives error when running
def sensas(lst):
lst_unica = [i for n, i in enumerate(lst_com_unicos) if i not in lst_com_unicos[n + 1:]]
for lst_resulta_unica in lst_unica:
return lst_resulta_unica
mistakes:
1) sensas((a,b,c,a,b,c)) Traceback (Most recent call last): Python Shell, prompt 3, line 1 Nameerror: name 'a' is not defined
2) sensates ((1,2,3,1,2,3)) Traceback (Most recent call last): Python Shell, prompt 4, line 1 File "/Users/Rute/Desktop/Untitled-1a.py", line 39, in lst_unica = [i for n, i in enumerate(lst_com_unicos) if i not in lst_com_unicos[n + 1:]] Nameerror: global name 'lst_com_unicos' is not defined
3) ensas([1,2,3,1,2,3]) Traceback (Most recent call last): Python Shell, prompt 5, line 1 File "/Users/Rute/Desktop/Untitled-1a.py", line 39, in lst_unica = [i for n, i in enumerate(lst_com_unicos) if i not in lst_com_unicos[n + 1:]] Nameerror: global name 'lst_com_unicos' is not defined
you don’t have a variable called
lst_com_unicos
in its function or with global variable. You will have to create it. I advise you to study further theTracebacks
, understand them will help you a lot :)– WhoisMatt