I have a list that encases the items within apostrophes and I can use the following 'for loop'
list1 = ['1','2','3']
list2 = [i * 5 for i in list1]
print list2
which appears to treat the list items as numbers, yet when I change the multiply sign to an add sign:
list1 = ['1','2','3']
list2 = [i + 5 for i in list1]
print list2
I get the error "cannot concatenate 'str' and 'int' objects". If the list items were strings, I shouldn't be able to multiply them. Since I can they must be numbers, so in that case why can't I add anything to them?
EDIT: Can someone please tell me why this question is bad? I have read through the posting rules but am about to be kicked because I am getting a lot of negative feedback but I am just a beginner and am trying to write as best as I can.