Embed presentation
Download to read offline
![python help please. not sure why code is not working for the input displayed at the bottom.
currently using this code
for i in range(dataLength) :
if (i!=len(data)-1):
print(data[i],end=',')
else:
print(data[i],end='#')
Brightspace would look like this: { ist element 1},{1 ist element 2},{1 ist element 3},,{ last list
element }# You are going to take the data from the list provided via input and output its contents in
this format. Details Input - Program input is handled for you. After some initial processing (by me),
you will be left with the following: - an array called data (with elements of the String data type).
Processing/Output - Loop through the array data - Output the elements from the array such that
each element is separated by a comma and the last element is followed by the the character
AtOutput: Expected: # Feedback: Input: string EOF](https://image.slidesharecdn.com/pythonhelppleasenotsurewhycodeisnotworkingforthe-230320111455-ae6d1ee5/85/python-help-please-not-sure-why-code-is-not-working-for-the-pdf-1-320.jpg)
The user is trying to print out the elements of a data array separated by commas, with the last element followed by a # character. Their code is not working properly for the given input. They provide an example output format and details that the input is an array called data containing string elements. They want help figuring out why their for loop code to print this output is not working for the provided test input.
![python help please. not sure why code is not working for the input displayed at the bottom.
currently using this code
for i in range(dataLength) :
if (i!=len(data)-1):
print(data[i],end=',')
else:
print(data[i],end='#')
Brightspace would look like this: { ist element 1},{1 ist element 2},{1 ist element 3},,{ last list
element }# You are going to take the data from the list provided via input and output its contents in
this format. Details Input - Program input is handled for you. After some initial processing (by me),
you will be left with the following: - an array called data (with elements of the String data type).
Processing/Output - Loop through the array data - Output the elements from the array such that
each element is separated by a comma and the last element is followed by the the character
AtOutput: Expected: # Feedback: Input: string EOF](https://image.slidesharecdn.com/pythonhelppleasenotsurewhycodeisnotworkingforthe-230320111455-ae6d1ee5/85/python-help-please-not-sure-why-code-is-not-working-for-the-pdf-1-320.jpg)