In C#:
List<string> stringList = new List<string>() { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE" };
for (int i = 0; i < stringList.Count; i++)
Console.WriteLine(i + ": " + stringList[i]);
Output:
0: AAAA
1: BBBB
2: CCCC
3: DDDD
4: EEEE
In Python:
stringList = ["AAAA", "BBBB", "CCCC", "DDDD", "EEEE"]
for i, string in enumerate(stringList):
print(i + ": " + string)
I want output same as the output above, but there is error:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
iis not a string, but anint. Usestr(i)