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


Groups > comp.lang.python > #100324 > unrolled thread

Need help on a project To :"Create a class called BankAccount with the following parameters "

Started byHarbey Leke <idowuolawale@gmail.com>
First post2015-12-12 01:05 -0800
Last post2016-03-05 13:27 +0100
Articles 20 on this page of 109 — 43 participants

Back to article view | Back to comp.lang.python


Contents

  Need help on  a project  To :"Create a class called BankAccount with the following parameters " Harbey Leke <idowuolawale@gmail.com> - 2015-12-12 01:05 -0800
    Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2015-12-12 20:21 +1100
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Harbey Leke <idowuolawale@gmail.com> - 2015-12-12 02:09 -0800
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2015-12-12 21:17 +1100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Harbey Leke <idowuolawale@gmail.com> - 2015-12-12 02:27 -0800
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Harbey Leke <idowuolawale@gmail.com> - 2015-12-12 02:29 -0800
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Warrick <kwpolska@gmail.com> - 2015-12-12 11:37 +0100
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Steven D'Aprano <steve@pearwood.info> - 2015-12-12 23:32 +1100
      Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " mkatietola@gmail.com - 2015-12-12 09:37 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " malitician@gmail.com - 2015-12-18 19:15 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-19 14:47 +0000
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " malitician@gmail.com - 2015-12-19 15:19 -0800
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-20 00:41 +0000
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Michael Torrie <torriem@gmail.com> - 2015-12-19 18:09 -0700
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-25 15:08 -0800
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-25 15:09 -0800
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Erik <python@lucidity.plus.com> - 2015-12-26 00:01 +0000
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Cameron Simpson <cs@zip.com.au> - 2015-12-26 11:09 +1100
                Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-25 18:04 -0800
                  Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Larry Hudson <orgnut@yahoo.com> - 2015-12-25 20:02 -0800
                  Re: Need help on a project To :"Create a class called BankAccount with the following parameters " malitician@gmail.com - 2015-12-26 00:47 -0800
                Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-25 18:36 -0800
                Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-26 02:38 -0800
                  Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-26 03:23 -0800
                    Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Cameron Simpson <cs@zip.com.au> - 2015-12-27 07:20 +1100
                      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-27 07:02 -0800
                        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Erik <python@lucidity.plus.com> - 2015-12-27 15:26 +0000
                          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-27 12:26 -0800
                        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Prince Udoka <princeudo52@gmail.com> - 2015-12-27 12:32 -0800
                          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-27 12:54 -0800
                          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Erik <python@lucidity.plus.com> - 2015-12-27 21:42 +0000
                          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Cameron Simpson <cs@zip.com.au> - 2015-12-28 14:32 +1100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-20 01:51 +0000
      Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " anyanwuchukwuemeka9@gmail.com - 2016-03-19 14:40 -0700
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Joel Goldstick <joel.goldstick@gmail.com> - 2016-03-19 18:03 -0400
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Mark Lawrence <breamoreboy@yahoo.co.uk> - 2016-03-19 22:24 +0000
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Ben Finney <ben+python@benfinney.id.au> - 2016-03-20 11:26 +1100
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Denis McMahon <denismfmcmahon@gmail.com> - 2015-12-20 11:04 +0000
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2015-12-20 22:29 +1100
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " jeanbigboute@gmail.com - 2015-12-25 20:15 -0800
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-26 01:52 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-24 04:39 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-24 11:57 -0500
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-24 04:59 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2015-12-25 00:10 +1100
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-24 06:17 -0800
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2015-12-25 01:39 +1100
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " malitician@gmail.com - 2015-12-24 11:36 -0800
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Tim Chase <python.list@tim.thechases.com> - 2015-12-24 14:48 -0600
                Re: Need help on a project To :"Create a class called BankAccount with the following parameters " malitician@gmail.com - 2015-12-26 01:01 -0800
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Erik <python@lucidity.plus.com> - 2015-12-24 21:09 +0000
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Joel Goldstick <joel.goldstick@gmail.com> - 2015-12-24 10:47 -0500
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " "D'Arcy J.M. Cain" <darcy@VybeNetworks.com> - 2015-12-24 11:14 -0500
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Grant Edwards <invalid@invalid.invalid> - 2015-12-24 17:30 +0000
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Gene Heskett <gheskett@wdtv.com> - 2015-12-24 13:51 -0500
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " "D'Arcy J.M. Cain" <darcy@VybeNetworks.com> - 2015-12-24 14:09 -0500
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-24 18:55 -0500
              Re: Need help on a project To :"Create a class called BankAccount   with the following parameters " Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-12-26 11:36 +1300
                Re: Need help on a project To :"Create a class called BankAccount   with the following parameters " Grant Edwards <invalid@invalid.invalid> - 2015-12-31 16:46 +0000
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2015-12-25 03:31 +1100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " princeudo52@gmail.com - 2015-12-25 15:05 -0800
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " xaviertim017@gmail.com - 2016-01-01 15:15 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-28 01:25 -0800
      Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Prince Udoka <princeudo52@gmail.com> - 2015-12-28 01:29 -0800
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Prince Udoka <princeudo52@gmail.com> - 2015-12-28 01:39 -0800
          Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " homiemusa@gmail.com - 2016-01-11 13:22 -0800
      Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Prince Udoka <princeudo52@gmail.com> - 2015-12-28 01:34 -0800
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Ben Finney <ben+python@benfinney.id.au> - 2015-12-28 20:41 +1100
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Cameron Simpson <cs@zip.com.au> - 2015-12-29 09:29 +1100
          Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-29 00:49 -0800
            Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Cameron Simpson <cs@zip.com.au> - 2015-12-29 21:48 +1100
              Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-29 04:39 -0800
          Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " homiemusa@gmail.com - 2016-01-11 14:07 -0800
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-01-11 19:46 -0500
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Prince Udoka <princeudo52@gmail.com> - 2015-12-28 23:35 +0100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " phatsammhiel@gmail.com - 2016-01-13 05:27 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Ben Finney <ben+python@benfinney.id.au> - 2015-12-28 20:38 +1100
        Re: Need help on a project To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2015-12-28 01:53 -0800
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Joel Goldstick <joel.goldstick@gmail.com> - 2015-12-28 07:32 -0500
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " botic <princeudo52@gmail.com> - 2015-12-28 14:10 -0800
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " phatsammhiel@gmail.com - 2016-01-13 05:28 -0800
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2016-01-14 00:37 +1100
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Joel Goldstick <joel.goldstick@gmail.com> - 2016-01-13 09:43 -0500
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Tim Golden <mail@timgolden.me.uk> - 2016-01-13 15:23 +0000
              Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Andrew Ongko <andrew.ongko@gmail.com> - 2016-01-13 22:35 +0700
            Re: Need help on a project To :"Create a class called BankAccount with the following parameters " phatsammhiel@gmail.com - 2016-01-13 05:44 -0800
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " kasale.jacktone@gmail.com - 2016-01-14 03:50 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-28 14:27 +0000
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " Won Chang <princeudo52@gmail.com> - 2015-12-30 10:21 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Joel Goldstick <joel.goldstick@gmail.com> - 2015-12-30 15:06 -0500
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Joel Goldstick <joel.goldstick@gmail.com> - 2015-12-30 15:11 -0500
      Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " acushla4real@gmail.com - 2016-01-08 08:37 -0800
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " ifeanyioprah@gmail.com - 2016-01-11 21:26 -0800
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " ifeanyioprah@gmail.com - 2016-01-11 21:30 -0800
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " ifeanyioprah@gmail.com - 2016-01-11 21:33 -0800
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " ifeanyioprah@gmail.com - 2016-01-11 21:33 -0800
        Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " chetam.chetzy@gmail.com - 2016-03-13 17:17 -0700
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2016-03-14 11:40 +1100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " MRAB <python@mrabarnett.plus.com> - 2016-03-14 00:57 +0000
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Chris Angelico <rosuav@gmail.com> - 2016-03-14 12:02 +1100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Ben Finney <ben+python@benfinney.id.au> - 2016-03-14 12:08 +1100
          Re: Need help on a project To :"Create a class called BankAccount with the following parameters " BartC <bc@freeuk.com> - 2016-03-14 01:33 +0000
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " xaviertim017@gmail.com - 2016-01-01 16:24 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " mrkimanindegwa@gmail.com - 2016-01-11 23:21 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " lee <malitician@gmail.com> - 2016-01-12 05:20 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " bonfaceo3@gmail.com - 2016-01-13 03:14 -0800
    Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " lucasfrank254@gmail.com - 2016-03-04 23:41 -0800
      Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Peter Otten <__peter__@web.de> - 2016-03-05 10:07 +0100
      Re: Need help on  a project  To :"Create a class called BankAccount with the following parameters " "Albert Visser" <albert.visser@gmail.com> - 2016-03-05 13:27 +0100

Page 4 of 6 — ← Prev page 1 2 3 [4] 5 6  Next page →


#100865 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

Fromprinceudo52@gmail.com
Date2015-12-25 15:05 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<c769b25c-6dc9-497c-9346-ba5faeee7030@googlegroups.com>
In reply to#100807
i have gotten the answer of that problem

[toc] | [prev] | [next] | [standalone]


#101126 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

Fromxaviertim017@gmail.com
Date2016-01-01 15:15 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<02c64730-8efc-4c84-8739-12e0bcabd3e2@googlegroups.com>
In reply to#100865
On Saturday, December 26, 2015 at 12:06:07 AM UTC+1, Won Chang wrote:
> i have gotten the answer of that problem

Please Can you post the answer you got. If convenient send to my email xaviertim017@gmail.com. 

Thanks in advance.

[toc] | [prev] | [next] | [standalone]


#100924

Fromlee <malitician@gmail.com>
Date2015-12-28 01:25 -0800
Message-ID<79ce6cf5-4bad-47f6-8824-44ce9849d825@googlegroups.com>
In reply to#100324
I'm still stuck on this, any Rescuer?

[toc] | [prev] | [next] | [standalone]


#100925

FromPrince Udoka <princeudo52@gmail.com>
Date2015-12-28 01:29 -0800
Message-ID<098af50f-4aef-4b72-8e16-c011054f9a40@googlegroups.com>
In reply to#100924
wow thats true the code did not work

[toc] | [prev] | [next] | [standalone]


#100928

FromPrince Udoka <princeudo52@gmail.com>
Date2015-12-28 01:39 -0800
Message-ID<ab66b2cb-b58e-4622-9de2-6c21056b79a7@googlegroups.com>
In reply to#100925
def manipulate_data(kind, data): 
    if kind == 'list': 
        return list(data)[::-1] 
    elif kind == 'set':
        return set(data)
    elif kind == 'dictionary': 
        return dict.keys(data) 
manipulate_data("list", range(1,6)) 
manipulate_data("set", {"a", "b", "c", "d", "e",}) 
manipulate_data("dictionary", {"apples": 23, "oranges": 15, "mangoes": 3, "grapes": 45})
just use a function to add "ANDELA", "TIA", "AFRICA" to the set, the u are don

[toc] | [prev] | [next] | [standalone]


#101491

Fromhomiemusa@gmail.com
Date2016-01-11 13:22 -0800
Message-ID<63ccdec5-87ed-452d-8878-92403afb2c68@googlegroups.com>
In reply to#100928
On Monday, December 28, 2015 at 12:39:41 PM UTC+3, Won Chang wrote:
> def manipulate_data(kind, data): 
>     if kind == 'list': 
>         return list(data)[::-1] 
>     elif kind == 'set':
>         return set(data)
>     elif kind == 'dictionary': 
>         return dict.keys(data) 
> manipulate_data("list", range(1,6)) 
> manipulate_data("set", {"a", "b", "c", "d", "e",}) 
> manipulate_data("dictionary", {"apples": 23, "oranges": 15, "mangoes": 3, "grapes": 45})
> just use a function to add "ANDELA", "TIA", "AFRICA" to the set, the u are don


how con i add a fuction

[toc] | [prev] | [next] | [standalone]


#100926

FromPrince Udoka <princeudo52@gmail.com>
Date2015-12-28 01:34 -0800
Message-ID<57a7133b-8ee0-4196-b2e5-6aa393a4e5fb@googlegroups.com>
In reply to#100924
bu i have come up with a solution, that will work but encounter a problem in the set, giving set not manipulated correctly:
def manipulate_data(kind, data): 
    if kind == 'list': 
        return list(data)[::-1] 
    elif kind == 'set':
        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})

the thing now is the function to use in adding "ANDELA", "TIA", "AFRICA"
pls 4give my use of language

[toc] | [prev] | [next] | [standalone]


#100929 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

FromBen Finney <ben+python@benfinney.id.au>
Date2015-12-28 20:41 +1100
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.39.1451295905.11925.python-list@python.org>
In reply to#100926
Prince Udoka <princeudo52@gmail.com> writes:

> pls 4give my use of language

Your messages are becoming quite disruptive and inconsiderate of your
readers.

Please take more care with each message, don't bombard us with a series
of poorly-thought-out, hyper-abbreviated messages.

Please take extreme-beginner discussions to the ‘tutor’
<URL:https://mail.python.org/mailman/listinfo/tutor> forum.

-- 
 \           “All progress has resulted from people who took unpopular |
  `\                                      positions.” —Adlai Stevenson |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#100938

FromCameron Simpson <cs@zip.com.au>
Date2015-12-29 09:29 +1100
Message-ID<mailman.42.1451341798.11925.python-list@python.org>
In reply to#100926
On 28Dec2015 01:34, Prince Udoka <princeudo52@gmail.com> wrote:
>bu i have come up with a solution, that will work but encounter a problem in the set, giving set not manipulated correctly:
>
>def manipulate_data(kind, data):
>    if kind == 'list':
>        return list(data)[::-1]
>    elif kind == 'set':
>        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})
>
>the thing now is the function to use in adding "ANDELA", "TIA", "AFRICA"
>pls 4give my use of language

You are very close. Let me remind you of the original task text:

  add items `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set and return the 
  resulting set

Your previous attempt (with hardwired values inside the function) actually had 
code to do it.

While you have pulled out all the hardwired values from the function (good) and 
put them in the external calls, note that the task explicitly says "add items 
`"ANDELA"`, `"TIA"` and `"AFRICA"` to the set". So _those_ values _are_ 
supposed to be hardwired inside the function - they are a fixed part of the 
task. So move them back in, as in your previous attempt.

There is some ambiguity in that part of the question: should you return a _new_ 
set consistint of the original set plus the three new values, or simply add the 
three values to the original set? Your prior code modified the original set, 
which may fit the task specification.

However, it is a common design objective that functions do not, _normally_, 
modify their arguments. So, consider this code:

  set1 = {"a", "b", "c", "d", "e"}
  set2 = manipulate_data("set", set1)

After running this, set2 should look like this:

  {"a", "b", "c", "d", "e", "ANDELA", "TIA", "AFRICA"}

(in some order -- sets are not ordered). However, what about set1? In your 
current code, set1 is modified, so it will be the same. But you can imagine 
that it would be more useful for the caller if set1 were unchanged.

In python, the convention is usually that if a function returns the new value 
then it should not modify the original. So you should probably construct a copy 
of the original set and modify that:

  data = set(data)
  ... add the new values ...
  return data

Cheers,
Cameron Simpson <cs@zip.com.au>

[toc] | [prev] | [next] | [standalone]


#100946

Fromlee <malitician@gmail.com>
Date2015-12-29 00:49 -0800
Message-ID<87543121-d6b5-46da-8b0e-b3001a9afd69@googlegroups.com>
In reply to#100938
On Monday, December 28, 2015 at 11:30:18 PM UTC+1, Cameron Simpson wrote:
> On 28Dec2015 01:34, Prince Udoka  wrote:
> >bu i have come up with a solution, that will work but encounter a problem in the set, giving set not manipulated correctly:
> >
> >def manipulate_data(kind, data):
> >    if kind == 'list':
> >        return list(data)[::-1]
> >    elif kind == 'set':
> >        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})
> >
> >the thing now is the function to use in adding "ANDELA", "TIA", "AFRICA"
> >pls 4give my use of language
> 
> You are very close. Let me remind you of the original task text:
> 
>   add items `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set and return the 
>   resulting set
> 
> Your previous attempt (with hardwired values inside the function) actually had 
> code to do it.
> 
> While you have pulled out all the hardwired values from the function (good) and 
> put them in the external calls, note that the task explicitly says "add items 
> `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set". So _those_ values _are_ 
> supposed to be hardwired inside the function - they are a fixed part of the 
> task. So move them back in, as in your previous attempt.
> 
> There is some ambiguity in that part of the question: should you return a _new_ 
> set consistint of the original set plus the three new values, or simply add the 
> three values to the original set? Your prior code modified the original set, 
> which may fit the task specification.
> 
> However, it is a common design objective that functions do not, _normally_, 
> modify their arguments. So, consider this code:
> 
>   set1 = {"a", "b", "c", "d", "e"}
>   set2 = manipulate_data("set", set1)
> 
> After running this, set2 should look like this:
> 
>   {"a", "b", "c", "d", "e", "ANDELA", "TIA", "AFRICA"}
> 
> (in some order -- sets are not ordered). However, what about set1? In your 
> current code, set1 is modified, so it will be the same. But you can imagine 
> that it would be more useful for the caller if set1 were unchanged.
> 
> In python, the convention is usually that if a function returns the new value 
> then it should not modify the original. So you should probably construct a copy 
> of the original set and modify that:
> 
>   data = set(data)
>   ... add the new values ...
>   return data
> 
> Cheers,
> Cameron Simpson <cs@zip.com.au>

thumbs up Cameron  , you and others here are really wonderful 

[toc] | [prev] | [next] | [standalone]


#100947

FromCameron Simpson <cs@zip.com.au>
Date2015-12-29 21:48 +1100
Message-ID<mailman.50.1451386093.11925.python-list@python.org>
In reply to#100946
On 29Dec2015 00:49, lee <malitician@gmail.com> wrote:
>thumbs up Cameron  , you and others here are really wonderful
>https://mail.python.org/mailman/listinfo/python-list

Hi Lee,

While we're generally happy to help, these questions are better taken to the 
tutor list here:

  https://mail.python.org/mailman/listinfo/tutor

Please join that list and ask you questions there.

The "python-list" list is more for people who are already competent with Python 
and programming and who are asking broader questions. The tutor list is 
specificly aimed at people like yourself who are either very new to Python or 
new to programming (and learning to program in Python).

Note that I have directed replies to this specific message to myself, we're off 
topic for python-list now...

Cheers,
Cameron Simpson <cs@zip.com.au>

[toc] | [prev] | [next] | [standalone]


#100952

Fromlee <malitician@gmail.com>
Date2015-12-29 04:39 -0800
Message-ID<ee0d4e7b-f805-4601-9481-dd2b62bdd8b8@googlegroups.com>
In reply to#100947
On Tuesday, December 29, 2015 at 11:48:42 AM UTC+1, Cameron Simpson wrote:
> On 29Dec2015 00:49, lee wrote:
> >thumbs up Cameron  , you and others here are really wonderful
> >https://mail.python.org/mailman/listinfo/python-list
> 
> Hi Lee,
> 
> While we're generally happy to help, these questions are better taken to the 
> tutor list here:
> 
>   https://mail.python.org/mailman/listinfo/tutor
> 
> Please join that list and ask you questions there.
> 
> The "python-list" list is more for people who are already competent with Python 
> and programming and who are asking broader questions. The tutor list is 
> specificly aimed at people like yourself who are either very new to Python or 
> new to programming (and learning to program in Python).
> 
> Note that I have directed replies to this specific message to myself, we're off 
> topic for python-list now...
> 
> Cheers,
> Cameron Simpson <cs@zip.com.au>


thanks Cameron,
i really appreciate your polite response and effort, i will join that list as you suggested.
Thanks again  

[toc] | [prev] | [next] | [standalone]


#101495

Fromhomiemusa@gmail.com
Date2016-01-11 14:07 -0800
Message-ID<46ed5b1a-ce41-41c8-9570-a8f410db6d01@googlegroups.com>
In reply to#100938
On Tuesday, December 29, 2015 at 1:30:18 AM UTC+3, Cameron Simpson wrote:
> On 28Dec2015 01:34, Prince Udoka <princeudo52@gmail.com> wrote:
> >bu i have come up with a solution, that will work but encounter a problem in the set, giving set not manipulated correctly:
> >
> >def manipulate_data(kind, data):
> >    if kind == 'list':
> >        return list(data)[::-1]
> >    elif kind == 'set':
> >        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})
> >
> >the thing now is the function to use in adding "ANDELA", "TIA", "AFRICA"
> >pls 4give my use of language
> 
> You are very close. Let me remind you of the original task text:
> 
>   add items `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set and return the 
>   resulting set
> 
> Your previous attempt (with hardwired values inside the function) actually had 
> code to do it.
> 
> While you have pulled out all the hardwired values from the function (good) and 
> put them in the external calls, note that the task explicitly says "add items 
> `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set". So _those_ values _are_ 
> supposed to be hardwired inside the function - they are a fixed part of the 
> task. So move them back in, as in your previous attempt.
> 
> There is some ambiguity in that part of the question: should you return a _new_ 
> set consistint of the original set plus the three new values, or simply add the 
> three values to the original set? Your prior code modified the original set, 
> which may fit the task specification.
> 
> However, it is a common design objective that functions do not, _normally_, 
> modify their arguments. So, consider this code:
> 
>   set1 = {"a", "b", "c", "d", "e"}
>   set2 = manipulate_data("set", set1)
> 
> After running this, set2 should look like this:
> 
>   {"a", "b", "c", "d", "e", "ANDELA", "TIA", "AFRICA"}
> 
> (in some order -- sets are not ordered). However, what about set1? In your 
> current code, set1 is modified, so it will be the same. But you can imagine 
> that it would be more useful for the caller if set1 were unchanged.
> 
> In python, the convention is usually that if a function returns the new value 
> then it should not modify the original. So you should probably construct a copy 
> of the original set and modify that:
> 
>   data = set(data)
>   ... add the new values ...
>   return data
> 
> Cheers,
> Cameron Simpson <cs@zip.com.au>


please help me how can i add a function  to this code am a star

[toc] | [prev] | [next] | [standalone]


#101504 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2016-01-11 19:46 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.32.1452559574.13488.python-list@python.org>
In reply to#101495
On Mon, 11 Jan 2016 14:07:49 -0800 (PST), homiemusa@gmail.com declaimed the
following:

>please help me how can i add a function  to this code am a star

	Read the Python tutorial... Look in the help system for "function"... 

	Functions are basic features of practically every programming language.
Even K&K BASIC from 1968 has them... (not to mention LISP and FORTRAN from
the 50s).

	These are questions that your instructor should have answered in the
class.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#100940 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

FromPrince Udoka <princeudo52@gmail.com>
Date2015-12-28 23:35 +0100
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.44.1451342380.11925.python-list@python.org>
In reply to#100926
thanks everyone, though it was very tough, but i thank GOD

On Mon, Dec 28, 2015 at 11:29 PM, Cameron Simpson <cs@zip.com.au> wrote:

> On 28Dec2015 01:34, Prince Udoka <princeudo52@gmail.com> wrote:
>
>> bu i have come up with a solution, that will work but encounter a problem
>> in the set, giving set not manipulated correctly:
>>
>> def manipulate_data(kind, data):
>>    if kind == 'list':
>>        return list(data)[::-1]
>>    elif kind == 'set':
>>        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})
>>
>> the thing now is the function to use in adding "ANDELA", "TIA", "AFRICA"
>> pls 4give my use of language
>>
>
> You are very close. Let me remind you of the original task text:
>
>  add items `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set and return the
> resulting set
>
> Your previous attempt (with hardwired values inside the function) actually
> had code to do it.
>
> While you have pulled out all the hardwired values from the function
> (good) and put them in the external calls, note that the task explicitly
> says "add items `"ANDELA"`, `"TIA"` and `"AFRICA"` to the set". So _those_
> values _are_ supposed to be hardwired inside the function - they are a
> fixed part of the task. So move them back in, as in your previous attempt.
>
> There is some ambiguity in that part of the question: should you return a
> _new_ set consistint of the original set plus the three new values, or
> simply add the three values to the original set? Your prior code modified
> the original set, which may fit the task specification.
>
> However, it is a common design objective that functions do not,
> _normally_, modify their arguments. So, consider this code:
>
>  set1 = {"a", "b", "c", "d", "e"}
>  set2 = manipulate_data("set", set1)
>
> After running this, set2 should look like this:
>
>  {"a", "b", "c", "d", "e", "ANDELA", "TIA", "AFRICA"}
>
> (in some order -- sets are not ordered). However, what about set1? In your
> current code, set1 is modified, so it will be the same. But you can imagine
> that it would be more useful for the caller if set1 were unchanged.
>
> In python, the convention is usually that if a function returns the new
> value then it should not modify the original. So you should probably
> construct a copy of the original set and modify that:
>
>  data = set(data)
>  ... add the new values ...
>  return data
>
> Cheers,
> Cameron Simpson <cs@zip.com.au>
>

[toc] | [prev] | [next] | [standalone]


#101613 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

Fromphatsammhiel@gmail.com
Date2016-01-13 05:27 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<3a7cd450-dd0a-4c04-a608-980d5aa42648@googlegroups.com>
In reply to#100940
please assist with the solution on this

p
h
a
t
s
a
m
m
hi
e
l@gmail.com

thanks

[toc] | [prev] | [next] | [standalone]


#100927 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

FromBen Finney <ben+python@benfinney.id.au>
Date2015-12-28 20:38 +1100
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.38.1451295512.11925.python-list@python.org>
In reply to#100924
lee <malitician@gmail.com> writes:

> I'm still stuck on this, any Rescuer?

You appear to be yet another different person asking about this homework
assignment.

Please:

* This forum is not suitable for the kind of close attention to very
  basic learning. Take this discussion to the ‘tutor’ forum
  <URL:https://mail.python.org/mailman/listinfo/tutor>, which is much
  better focussed on close collaborative mentoring of beginners.

* Choose a single spokesperson, and have that person provide continuity
  in the discussion by responding consistently from the same email
  address.

* Learn proper email etiquette (plain text messages, quoted material,
  give sufficient context, etc.) to help the community understand what
  each message is about.

-- 
 \        “Holy uncanny photographic mental processes, Batman!” —Robin |
  `\                                                                   |
_o__)                                                                  |
Ben Finney

[toc] | [prev] | [next] | [standalone]


#100930 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

Fromlee <malitician@gmail.com>
Date2015-12-28 01:53 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<4023d75d-5e96-40b0-b1b1-a193c722004d@googlegroups.com>
In reply to#100927
On Monday, December 28, 2015 at 10:38:47 AM UTC+1, Ben Finney wrote:
> lee writes:
> 
> > I'm still stuck on this, any Rescuer?
> 
> You appear to be yet another different person asking about this homework
> assignment.
> 
> Please:
> 
> * This forum is not suitable for the kind of close attention to very
>   basic learning. Take this discussion to the 'tutor' forum
>   <URL:https://mail.python.org/mailman/listinfo/tutor>, which is much
>   better focussed on close collaborative mentoring of beginners.
> 
> * Choose a single spokesperson, and have that person provide continuity
>   in the discussion by responding consistently from the same email
>   address.
> 
> * Learn proper email etiquette (plain text messages, quoted material,
>   give sufficient context, etc.) to help the community understand what
>   each message is about.
> 
> -- 
>  \        "Holy uncanny photographic mental processes, Batman!" --Robin |
>   `\                                                                   |
> _o__)                                                                  |
> Ben Finney


if you have followed this thread from the beginning , you should have  been aware that different people have contributed in asking/answering on this same discussion and nobody has any problem with that, so please if someone ( same or different) needs help on a single problem , allow them contribute, they could be the source of getting the problem solved. thanks prince( botic) , will try you suggestion

[toc] | [prev] | [next] | [standalone]


#100931 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2015-12-28 07:32 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.40.1451307839.11925.python-list@python.org>
In reply to#100930
On Mon, Dec 28, 2015 at 4:53 AM, lee <malitician@gmail.com> wrote:

> On Monday, December 28, 2015 at 10:38:47 AM UTC+1, Ben Finney wrote:
> > lee writes:
> >
> > > I'm still stuck on this, any Rescuer?
> >
> > You appear to be yet another different person asking about this homework
> > assignment.
> >
> > Please:
> >
> > * This forum is not suitable for the kind of close attention to very
> >   basic learning. Take this discussion to the 'tutor' forum
> >   <URL:https://mail.python.org/mailman/listinfo/tutor>, which is much
> >   better focussed on close collaborative mentoring of beginners.
> >
> > * Choose a single spokesperson, and have that person provide continuity
> >   in the discussion by responding consistently from the same email
> >   address.
> >
> > * Learn proper email etiquette (plain text messages, quoted material,
> >   give sufficient context, etc.) to help the community understand what
> >   each message is about.
> >
> > --
> >  \        "Holy uncanny photographic mental processes, Batman!" --Robin |
> >   `\                                                                   |
> > _o__)                                                                  |
> > Ben Finney
>
>
> if you have followed this thread from the beginning , you should have
> been aware that different people have contributed in asking/answering on
> this same discussion and nobody has any problem with that, so please if
> someone ( same or different) needs help on a single problem , allow them
> contribute, they could be the source of getting the problem solved. thanks
> prince( botic) , will try you suggestion
> --
> https://mail.python.org/mailman/listinfo/python-list
>



-- 
Joel Goldstick
http://joelgoldstick.com/stats/birthdays

[toc] | [prev] | [next] | [standalone]


#100937 — Re: Need help on a project To :"Create a class called BankAccount with the following parameters "

Frombotic <princeudo52@gmail.com>
Date2015-12-28 14:10 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<1fa635dd-704b-41c6-a6e0-f3be0dac1fe5@googlegroups.com>
In reply to#100930
lee, i will give u the answer just inbox me princeudo55@yahoo.com, so that i can drop it privately

[toc] | [prev] | [next] | [standalone]


Page 4 of 6 — ← Prev page 1 2 3 [4] 5 6  Next page →

Back to top | Article view | comp.lang.python


csiph-web