I'm pretty new to python and I'm stacked on a simple problem: i have a list:
mylist = [1, 2, 3, 4]
if I extract one element like this:
print(my_list[1:2])
I get a list of one element, but i cannot compute any calculus by treating it as a variable :
print(my_list[1:2]+1)
because i get the error:
Traceback (most recent call last): File "C:\...\test_tuple.py", line XX, in <module> print(my_list[1:2]+1) TypeError: can only concatenate list (not "int") to list
how do I convert this single element list to a variable?
my_list[1].print(my_list[1:2][0]+1)