I have a list which contains various company names I am trying to extract each item from the list and concatenate it to a string. Here is how i do it:
stock = ['TATACHEM', 'SNOWMAN']
for element in stock:
z1='NSE:'+element
The Issue I face over here is that when I see z1 it contains only last element of the list concatenated with the string 'NSE' and the resulting output is:
NSE:SNOWMAN
However when I print all the element of the list it gives me all the elements. That is when I use:
for element in stock:
print(element)
It gives me a list of both the elements in the list:
TATACHEM
SNOWMAN
How do I modify my code above so as to get the following output:
NSE:SNOWMAN
NSE:TATACHEM