Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I want to place quotations for every element in a list. I am trying this
col = Table["\"" i "\"", {i, 0, 5}];
and I am getting
{0, ("\"")^2, 2 ("\"")^2, 3 ("\"")^2, 4 ("\"")^2, 5 ("\"")^2}
instead of
{"0", "2", "3", "4", "5"}
How should I correct it?
Thank you.
ToString
StringJoin
Table["\"" <> ToString[i] <> "\"", {i, 0, 5}]
col = Table["\"" <> ToString@ i <> "\"", {i, 0, 5}]
{"0","1","2","3","4","5"}
Alternatively, you can use IntegerString:
IntegerString
IntegerString @ Range[0, 5]
{"0", "1", "2", "3", "4", "5"}
ToString
andStringJoin
:Table["\"" <> ToString[i] <> "\"", {i, 0, 5}]
. Voting to close. $\endgroup$