python functions

Posted by bodeayeni on 2016-01-10 08:02

```
def manipulate_data(string,data):
#accepts string and manipulate data
if string=='list':
return"list.reverse"
elif string=='set':
set.add("ANDELA")
set.add("TIA")
set.add("AFRICA")
return set.result
elif string=='dictionary':
return s.keys()

#call the function with an ARGUMENT
manipulate_data(list,[25,16,9,4,1])
manipulate_data(set,{"ANDELA","TIA","AFRICA"})
manipulate_data(dictionary,{'apples','oranges','mangoes','grapes'})
```

After running the code i got this error. "NameError:name 'dictionary' is not defined.

Im not sure i know what that means,can somebody please help?here is the question below.

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.