Hey guys
what the different between sending a send as [] and *[]? For instance
thanks
what the different between sending a send as [] and *[]? For instance
def main(): x = [1] * 10 print(list(chain(*x))) print(list(chain(x)))
Error:Traceback (most recent call last):
File "/home/harish/hshivaraj/source/python/leetcode/2022/BAM/itertools_exp.py", line 8, in <module>
main()
File "/home/harish/hshivaraj/source/python/leetcode/2022/BAM/itertools_exp.py", line 6, in main
print(list(chain(*x)))
TypeError: 'int' object is not iterable
Calling first method with chain(*x) return a generator and when I pass the generator to list() it fails. does anyone have an explanation? thanks