I can't seem to understand what my mistake could be on this code

homework
python

#1

Here is the question: -
DS LAB

Create a function manipulate_data that does the following
Accepts as the first parameter a string specifying the data structure to be used "list", "set" or "dictionary"
Accepts as the second parameter the data to be manipulated based on the data structure specified e.g [1, 4, 9, 16, 25] for a list data structure
Based off the first parameter

return the reverse of a list or
add items `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set and return the resulting set
return the keys of a dictionary.

This my answer:-
def manipulate_data(result = "dictionary", data = {"a": "1", "b": "4", "c": "9", "d": "16", "e": "25"}):
ke = list(data)
return result, ke

and the screenshot will test any of the data structure and i can't seem to get it correct or maybe i didn't the question.


#2

@datawhiz25947

Take a look at this post, I have already cover this topic with another individual.

Post


#3

I tried out the code and it didn't work


#4

The point of any of these topics is to try and find the answer yourself, not just copy and paste the code. If all you want for these self-taught exercises is to copy and paste then there really is no reason for you to continue because the effect will be the same.

Now, if you really are serious about learning this then read the post and any comments pertaining to it and I believe you will get all the information you need to successfully complete this section and while at it learn something useful.

Another thing of note, if you are going to continue to use any type of forum whether it is is public or private you would do well to realize we are trying to help you, but if you only give statements like

Then there really is nothing we can do to help you because you failed to do even the most basic of trying to get the answer yourself, nor did you explain what failed or what you tried to do to correct it.

Again, I must stress this point if all you want to do is copy and paste just quit now and save your time. If on the other hand you want to learn any part of this ask questions and I or someone else will do our best to help you. Not because we are getting paid but because we would love to have more fellow programmers in the world.


#5

Thank you so much sir, i really appreciate all your assistance. I'm still reading other tutorials and trying to figure out the exercise and also trying to figure out if i really understood what the exercise is all about.


#6

When asking for help ensure that you inform us of what you have tried so that we can narrow down the list of things, another really helpful thing is to post your code and make sure you use markdown or the </>(codifty button) this will ensure that you get the help you need a lot quicker.

Also to use mark down do the following

```python

# Code Here

``` # End