a = [1,2,3,4,5]
All the integers in this array can be converted into strings individually in the following 3 ways.
1) Using Str
a=[1,2,3,4,5]
for i in range(len(a)):
a[i] = str(a[i])
print(type(a[0]))
2) Using Map
a=[1,2,3,4,5]
a = list(map(str,a))
print(type(a[0]))
3) Using List Comprehension
a=[1,2,3,4,5]
a = [str(i) for i in a]
print(type(a[0]))
Can I know what is the time complexity in all the 3 cases to find out which method is efficient? I am a bit confused about this.
Thanks in advance!