Suppose I need a n elements long with each element seperated by a space. Further, I need the ith element to be a 1 and the rest to be a 0. What’s the easiest pythonic way to do this?
Thus if n = 10, and i = 2, I would want
0 1 0 0 0 0 0 0 0 0
I want something like a new string[] that you can get in C++ but the Python version is eluding me.
Thanks!
Use a list.