Hi,
Pls, assist with this Question....Kindly stroll to the end
DS LABCreate a function manipulate_data that does the followingAccepts 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
My Answer below - Kindly helped reviewed it
def manipulate_data(kind, data): if kind == 'list': return
list(data)[::-1] elif kind == 'set': data=set({"a", "b", "c", "d",
"e", "ANDELA", "TIA", "AFRICA"}) return set(data) elif kind ==
'dictionary': return dict.keys(data) manipulate_data("list",
range(1,6)) manipulate_data("set", {"a", "b", "c", "d", "e", "ANDELA", "TIA",
"AFRICA"})manipulate_data("dictionary", {"apples": 23, "oranges": 15,
"mangoes": 3, "grapes": 45})
CODE RESULT
But i cant proceed to next stage...see error below Pls assist
Thanks
Regards
Shittu
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor