Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100890

please can i get help on this problem

Newsgroups comp.lang.python
Date 2015-12-26 03:36 -0800
Message-ID <f2cb81b4-f03f-4736-98ed-9e9a01f4e17e@googlegroups.com> (permalink)
Subject please can i get help on this problem
From Prince Udoka <princeudo52@gmail.com>

Show all headers | View raw


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.


here is my work, but i dont know what i ave done wrong:
def manipulate_data(list_data, set_data):
    if list_data == ["apples", "orange", "mangoes"]:
        for set_data in reversed(set_data):
            return set_data
    elif manipulate_data(list_data == {"apples", "orange", "mangoes"}):
        list_data.append("ANDELA", "TIA", "AFRICA")
        for set_data in list_data:
            return set_data
    if manipulate_data(list_data == {"apples": 23, "oranges": 15, "mangoes": 3, "grapes": 45}):
        return list_data.keys()

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

please can i get help on this problem Prince Udoka <princeudo52@gmail.com> - 2015-12-26 03:36 -0800
  Re: please can i get help on this problem Ben Finney <ben+python@benfinney.id.au> - 2015-12-26 23:15 +1100
    Re: please can i get help on this problem Prince Udoka <princeudo52@gmail.com> - 2015-12-26 04:26 -0800
    Re: please can i get help on this problem Prince Udoka <princeudo52@gmail.com> - 2015-12-26 05:13 -0800
      Re: please can i get help on this problem Ben Finney <ben+python@benfinney.id.au> - 2015-12-27 10:11 +1100
  Re: please can i get help on this problem User of Products <1991loctran@gmail.com> - 2015-12-27 21:00 -0800

csiph-web