This code gives me the expected output just fine:
1
>>> lista = ["8", "6"]
>>> lista = map(int, lista)
>>> print(list(lista))
'[8, 6]'
2
>>> lista = [8-2, 6-2]
>>> print(list(lista))
'[6, 4]'
But if I do something like this it doesn't work:
>>> lista = ["8-2", "6-2"]
>>> lista = map(int, lista)
>>> print(list(lista))
'print(list(lista))
^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '8-2''
Why is that?
In my head it would go just like the 2º code :(
like this:
>>> lista = ["8-2", "6-2"]
>>> lista = map(int, lista)
>>> print(list(lista))
'[6,4]'
#not a real situation
I'm a beginner!!! What should I do to have the expected output? (sorry for bad English)