Hi so I wanted to put array elements to become a string. The objective is I wanted to put the string in print function. For instance:
Given an array of [1, 2, 0, 1] Is there any way to make the elements to become one string (i.e. to be 1201)? Lets say the string variable is '''array_elements''' I want to have the output of:
the elements are: 1201.
So of course what I should do to the print function is:
print("the elements are: " + str(array_elements), ".")
The problem is, I'm a python beginner and i don't know how to solve the problem without using string function (since this is what google told me to do, but I'm now allowed to use that." What I could think of is by using looping but I still can't manage to make it as one string variable
strfunction, justprint(...)or use f-strings. If you want to join list elements, use''.join(your_list)and make sure the list contains strings.