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 3 of 6 — ← Prev page 1 2 [3] 4 5 6  Next page →


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

Fromprinceudo52@gmail.com
Date2015-12-26 01:52 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<3c8e53cb-4548-448f-9eb1-ebceef19c07f@googlegroups.com>
In reply to#100880
i am really enjoying u guyz, i didnt sleep yesterday night, but all is working out well now: i am 2weeks old in python, thanks you all for the assistance 

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


#100796

Fromprinceudo52@gmail.com
Date2015-12-24 04:39 -0800
Message-ID<d0ccc3cf-76ed-4295-98f3-0516e36f2859@googlegroups.com>
In reply to#100324
On Saturday, December 12, 2015 at 10:05:29 AM UTC+1, Harbey Leke wrote:
> Create a class called BankAccount
> 
> .Create a constructor that takes in an integer and assigns this to a `balance` property.
> 
> .Create a method called `deposit` that takes in cash deposit amount and updates the balance accordingly.
> 
> .Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"`
> 
> .Create a subclass MinimumBalanceAccount of the BankAccount class
> 
> Please i need help on this i am a beginer into python programming.
> 
> 
> Also below is a test case given for this project 
> 
> 
> import unittest
> class AccountBalanceTestCases(unittest.TestCase):
>   def setUp(self):
>     self.my_account = BankAccount(90)
>     
>   def test_balance(self):
>     self.assertEqual(self.my_account.balance, 90, msg='Account Balance Invalid')
>     
>   def test_deposit(self):
>     self.my_account.deposit(90)
>     self.assertEqual(self.my_account.balance, 180, msg='Deposit method inaccurate')
>     
>   def test_withdraw(self):
>     self.my_account.withdraw(40)
>     self.assertEqual(self.my_account.balance, 50, msg='Withdraw method inaccurate')
>     
>   def test_invalid_operation(self):
>     self.assertEqual(self.my_account.withdraw(1000), "invalid transaction", msg='Invalid transaction')
>   
>   def test_sub_class(self):
>     self.assertTrue(issubclass(MinimumBalanceAccount, BankAccount), msg='No true subclass of BankAccount')

please what is a balance property in OOP

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


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

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-12-24 11:57 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.118.1450976254.2237.python-list@python.org>
In reply to#100796
On Thu, 24 Dec 2015 04:39:40 -0800 (PST), princeudo52@gmail.com declaimed
the following:


>please what is a balance property in OOP

	So where have you looked for an answer...

https://en.wikipedia.org/wiki/Property_%28programming%29 (Google: property
oop wiki)
https://docs.python.org/2/library/functions.html#property (Google: property
python)

	This has all the earmarks of a homework project -- we will NOT provide
you working examples for homework (or, at least, not until after you've
received a verifiable grade for what you have produced). 

	All the concepts should have been introduced in the course materials.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


#100798

Fromprinceudo52@gmail.com
Date2015-12-24 04:59 -0800
Message-ID<1e0feecd-6292-406d-ac27-d32742a4023a@googlegroups.com>
In reply to#100324
here is what i came up with 
Class BankAccount(object):
def_init_(self, balance):
self.Balance = balance
def deposit(self, amount):
self.Balance = amount
def withdraw(self,amount):
if(self.Balance += amount):
return invalid transaction
#but my challange now is :Create a subclass MinimumBalanceAccount of the BankAccount class.

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


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

FromChris Angelico <rosuav@gmail.com>
Date2015-12-25 00:10 +1100
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.103.1450962626.2237.python-list@python.org>
In reply to#100798
On Thu, Dec 24, 2015 at 11:59 PM,  <princeudo52@gmail.com> wrote:
> here is what i came up with
> Class BankAccount(object):
> def_init_(self, balance):
> self.Balance = balance
> def deposit(self, amount):
> self.Balance = amount
> def withdraw(self,amount):
> if(self.Balance += amount):
> return invalid transaction
> #but my challange now is :Create a subclass MinimumBalanceAccount of the BankAccount class.

Step 1: Debug your code before you post it.

Step 2: Make sure that the way your code ends up is the same as the
way it started out. I suspect you have some of the above lines
indented, but that's getting lost.

Your code (a) will not compile, due to a complete lack of indentation;
(b) will not compile even if indented correctly, due to a misuse of an
'operator' that isn't actually an operator; (c) won't compile due to
invalid abuttal of tokens (did you intend to put quotes around
something?); (d) STILL won't compile because you misspelled a keyword;
and (e) won't do what you think it should, even once you make it
compile, because of logic errors. Don't move on to the second
challenge until you have mastered this first one.

ChrisA

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


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

Fromprinceudo52@gmail.com
Date2015-12-24 06:17 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<8297515b-834b-4829-abb4-0191a66222bb@googlegroups.com>
In reply to#100799
i am getting to believe that no one can provide a solution to this challenge, every-one here is just beating around the bush

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


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

FromChris Angelico <rosuav@gmail.com>
Date2015-12-25 01:39 +1100
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.111.1450967961.2237.python-list@python.org>
In reply to#100807
On Fri, Dec 25, 2015 at 1:17 AM,  <princeudo52@gmail.com> wrote:
> i am getting to believe that no one can provide a solution to this challenge, every-one here is just beating around the bush

It's not a question of 'can' but 'will'. We will not provide the
answer to your homework question. This has already been explained to
you.

ChrisA

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


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

Frommalitician@gmail.com
Date2015-12-24 11:36 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<ba0d4f7b-f178-481e-b2fc-4675e1e18197@googlegroups.com>
In reply to#100809
On Thursday, December 24, 2015 at 3:39:34 PM UTC+1, Chris Angelico wrote:
> On Fri, Dec 25, 2015 at 1:17 AM,  <princeudo52@gmail.com> wrote:
> > i am getting to believe that no one can provide a solution to this challenge, every-one here is just beating around the bush
> 
> It's not a question of 'can' but 'will'. We will not provide the
> answer to your homework question. This has already been explained to
> you.
> 
> ChrisA




you are right chris
it is a homework, but we are to figure out the solution first , all we need is some guidance please and not to be spoon fed like many thought 


in case anybody missed the question here is it 





>Create a class called BankAccount

>Create a constructor that takes in an integer and assigns this to a `balance` property.

>Create a method called `deposit` that takes in cash deposit amount and updates the balance accordingly.

>Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"`

>Create a subclass MinimumBalanceAccount of the BankAccount class



and there is a unittest that evaluate our code to check if we got it right ( i believe) and here  it is below








import unittest
class AccountBalanceTestCases(unittest.TestCase):
  def setUp(self):
    self.my_account = BankAccount(90)
    
  def test_balance(self):
    self.assertEqual(self.my_account.balance, 90, msg='Account Balance Invalid')
    
  def test_deposit(self):
    self.my_account.deposit(90)
    self.assertEqual(self.my_account.balance, 180, msg='Deposit method inaccurate')
    
  def test_withdraw(self):
    self.my_account.withdraw(40)
    self.assertEqual(self.my_account.balance, 50, msg='Withdraw method inaccurate')
    
  def test_invalid_operation(self):
    self.assertEqual(self.my_account.withdraw(1000), "invalid transaction", msg='Invalid transaction')
  
  def test_sub_class(self):
    self.assertTrue(issubclass(MinimumBalanceAccount, BankAccount), msg='No true subclass of BankAccount')




and i come up with this code which i believe i'm 80 percent correct




class BankAccount:
    def __init__(self, initial_amount):
        self.balance = initial_amount
    def deposit(self, amount):
        self.balance += amount
    def withdraw(self, amount):
        if self.balance>= amount:
            self.balance  -=  amount
        else:
          print('invalid transaction')

a1 = BankAccount (90)
a1.deposit(90)
a1.withdraw(40)
a1.withdraw(1000)
class MinimumBalanceAccount(BankAccount):
    def __init__(self):
        BankAccount.__init__(self)






but i kept getting this error from the unittest





{"finished": true, "success": [{"fullName": "test_balance", "passedSpecNumber": 1}, {"fullName": "test_deposit", "passedSpecNumber": 2}, {"fullName": "test_sub_class", "passedSpecNumber": 3}, {"fullName": "test_withdraw", "passedSpecNumber": 4}], "passed": false, "started": true, "failures": [{"failedSpecNumber": 1, "fullName": "test_invalid_operation", "failedExpectations": [{"message": "Failure in line 23, in test_invalid_operation\n    self.assertEqual(self.my_account.withdraw(1000), \"invalid transaction\", msg='Invalid transaction')\nAssertionError: Invalid transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0, "time": "0.000080"}}
invalid transaction
invalid transaction





its like this part of the unittest explains my error  




[{"message": "Failure in line 23, in test_invalid_operation\n    self.assertEqual(self.my_account.withdraw(1000), \"invalid transaction\", msg='Invalid transaction')\nAssertionError: Invalid transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0, "time": "0.000080"}}



but i dont know what it means or where i have gone wrong in my code
and for that need help on Create a subclass MinimumBalanceAccount of the BankAccount class

i believe the last three lines of my code answered your question.
i believe someone can help me with my problem.
Thanks in advance

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


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

FromTim Chase <python.list@tim.thechases.com>
Date2015-12-24 14:48 -0600
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.127.1450990711.2237.python-list@python.org>
In reply to#100826
On 2015-12-24 11:36, malitician@gmail.com wrote:
> it is a homework, but we are to figure out the solution first , all
> we need is some guidance please and not to be spoon fed like many
> thought 

Ah, with the intended interface as given by the tests, and the code
you've already put together, you'll find comp.lang.python is a much
friendlier place.


>   def test_invalid_operation(self):
>     self.assertEqual(self.my_account.withdraw(1000), "invalid
> transaction", msg='Invalid transaction') 

The test above is failing because your withdraw() method doesn't
return "invalid transaction" but rather prints it:

>     def withdraw(self, amount):
>         if self.balance>= amount:
>             self.balance  -=  amount
>         else:
>           print('invalid transaction')

as gleaned from this error message:

> [{"message": "Failure in line 23, in test_invalid_operation\n
> self.assertEqual(self.my_account.withdraw(1000), \"invalid
> transaction\", msg='Invalid transaction')\nAssertionError: Invalid
> transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0,
> "time": "0.000080"}}

The test says "I expected that calling the function would return
"invalid transaction" but it didn't" (a better test-runner would
also have let you know that it had returned None)

Though frankly, I'd consider that a bad test, since it's an
exceptional condition, so it should be checking that a custom
InvalidTransactionException was raised.  But sometimes you have to
work with what you've got.

-tkc


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


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

Frommalitician@gmail.com
Date2015-12-26 01:01 -0800
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<1294f59c-aa27-4f71-a7ba-29db98ef7750@googlegroups.com>
In reply to#100830
On Thursday, December 24, 2015 at 9:58:54 PM UTC+1, Tim Chase wrote:
> On 2015-12-24 11:36, malitician@gmail.com wrote:
> > it is a homework, but we are to figure out the solution first , all
> > we need is some guidance please and not to be spoon fed like many
> > thought 
> 
> Ah, with the intended interface as given by the tests, and the code
> you've already put together, you'll find comp.lang.python is a much
> friendlier place.
> 
> 
> >   def test_invalid_operation(self):
> >     self.assertEqual(self.my_account.withdraw(1000), "invalid
> > transaction", msg='Invalid transaction') 
> 
> The test above is failing because your withdraw() method doesn't
> return "invalid transaction" but rather prints it:
> 
> >     def withdraw(self, amount):
> >         if self.balance>= amount:
> >             self.balance  -=  amount
> >         else:
> >           print('invalid transaction')
> 
> as gleaned from this error message:
> 
> > [{"message": "Failure in line 23, in test_invalid_operation\n
> > self.assertEqual(self.my_account.withdraw(1000), \"invalid
> > transaction\", msg='Invalid transaction')\nAssertionError: Invalid
> > transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0,
> > "time": "0.000080"}}
> 
> The test says "I expected that calling the function would return
> "invalid transaction" but it didn't" (a better test-runner would
> also have let you know that it had returned None)
> 
> Though frankly, I'd consider that a bad test, since it's an
> exceptional condition, so it should be checking that a custom
> InvalidTransactionException was raised.  But sometimes you have to
> work with what you've got.
> 
> -tkc

you and others here saved my days , instead of "RETURN" i have been using "PRINT". i never knew the differences earlier . Problem solved , thanks for having guys like all of you here. I'm just a week old into python programming and i have learned a lot   .Merry xmas

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


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

FromErik <python@lucidity.plus.com>
Date2015-12-24 21:09 +0000
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.128.1450991352.2237.python-list@python.org>
In reply to#100826
On 24/12/15 19:36, malitician@gmail.com wrote:
> you are right chris
> it is a homework, but we are to figure out the solution first , all we need is some guidance please and not to be spoon fed like many thought

 From your response, it seems that this is a homework question that a 
group of you are working on. That might explain some of the confusion 
(both from your side, posting similar questions and slightly confusing 
replies) and from the list side (asking why different email addresses 
were being used - it all seemed a bit suspicious) ...

I would recommend that one of you acts as a spokesperson for the group.



However, this latest response is much better. You included your code, 
and it looks like it would compile (I haven't run it myself, but you've 
included reasonable results too).

Your problem looks like it's related to how the unit test harness 
reports its errors and I guess it's a bit unfair for you to completely 
have to understand how that works if you're just learning. However, the 
wording of the assignment _does_ give a clue as to the problem.

The error seems to be coming from the test for the "withdraw" method 
with a value greater that what should be the current balance:

 > [{"message": "Failure in line 23, in test_invalid_operation\n 
self.assertEqual(self.my_account.withdraw(1000), \"invalid 
transaction\", msg='Invalid transaction')\nAssertionError: Invalid 
transaction\n"}]}], "specs": {"count": 5, "pendingCount": 0, "time": 
"0.000080"}}

Your assignment said:

>> Create a method called `withdraw` that takes in cash withdrawal amount and updates the balance accordingly. if amount is greater than balance return `"invalid transaction"`

Your method is:

>      def withdraw(self, amount):
>          if self.balance>= amount:
>              self.balance  -=  amount
>          else:
>            print('invalid transaction')

Can you spot the difference between what the assignment is asking for 
and what the method is doing? Look at both paths carefully (when called 
with a valid amount and when called with an amount that is too large). 
Pay careful attention to the words the assignment uses.

> a1 = BankAccount (90)
> a1.deposit(90)
> a1.withdraw(40)
> a1.withdraw(1000)
> class MinimumBalanceAccount(BankAccount):
>      def __init__(self):
>          BankAccount.__init__(self)
[snip]
> i believe the last three lines of my code answered your question.

When the assignment requested you create a subclass, it probably 
expected a subclass that would run. Have you tried creating an instance 
of your subclass? Try it - you might see another problem that needs fixing.

E.

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


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

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2015-12-24 10:47 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.114.1450972027.2237.python-list@python.org>
In reply to#100807
On Thu, Dec 24, 2015 at 9:39 AM, Chris Angelico <rosuav@gmail.com> wrote:

> On Fri, Dec 25, 2015 at 1:17 AM,  <princeudo52@gmail.com> wrote:
> > i am getting to believe that no one can provide a solution to this
> challenge, every-one here is just beating around the bush
>
> It's not a question of 'can' but 'will'. We will not provide the
> answer to your homework question. This has already been explained to
> you.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Generally, the best way to receive help is to provide your code written in
a way that is indented (plain text), provide the complete text of what you
are being asked to do in your class, and copy and paste any output or
exceptions.

You don't seem to be willing to do any of these things, and consequently
you can't be helped.  Also, what is up with the handful of email addresses
used to post your 'demands'.

Not to be rude, but if your style of methodology for asking for help is
indicative of your general attitude, and interest in learning to write
software, you may be better served to find a new calling.  Its not a good
profession for people who basically say "do this for me"

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

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


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

From"D'Arcy J.M. Cain" <darcy@VybeNetworks.com>
Date2015-12-24 11:14 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.115.1450974306.2237.python-list@python.org>
In reply to#100807
On Thu, 24 Dec 2015 10:47:04 -0500
Joel Goldstick <joel.goldstick@gmail.com> wrote:
> Not to be rude, but if your style of methodology for asking for help
> is indicative of your general attitude, and interest in learning to
> write software, you may be better served to find a new calling.  Its
> not a good profession for people who basically say "do this for me"

Or we wish it wasn't.  That seems to be the style today.  People claim
to be programmers who only search the net for snippets to plug into
their programs with no actual understanding.  Or, they download a
Wordpress theme and call themselves web designers.

It reminds me of when one day people started claiming to be "building"
computers and they didn't even own a soldering iron.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:darcy@Vex.Net VoIP: sip:darcy@VybeNetworks.com

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


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

FromGrant Edwards <invalid@invalid.invalid>
Date2015-12-24 17:30 +0000
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<n5ha30$99b$1@reader1.panix.com>
In reply to#100813
On 2015-12-24, D'Arcy J.M. Cain <darcy@VybeNetworks.com> wrote:

> It reminds me of when one day people started claiming to be "building"
> computers and they didn't even own a soldering iron.

And don't get me started on those people who use those "integrated
circuits" instead of transistors, relays, and tubes...

-- 
Grant

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


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

FromGene Heskett <gheskett@wdtv.com>
Date2015-12-24 13:51 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.123.1450983470.2237.python-list@python.org>
In reply to#100820
On Thursday 24 December 2015 12:30:08 Grant Edwards wrote:

> On 2015-12-24, D'Arcy J.M. Cain <darcy@VybeNetworks.com> wrote:
> > It reminds me of when one day people started claiming to be
> > "building" computers and they didn't even own a soldering iron.
>
> And don't get me started on those people who use those "integrated
> circuits" instead of transistors, relays, and tubes...
>
> --
> Grant

Yeah, I'm sorta old fashioned that way. I can remember when electrolytic 
capacitors were actually wet. And tubes had numbers like an 80, or a 46, 
or a 2A3 for "high" powered audio even. Power transformers that made 700 
volts, center tapped of course, and because of the poor iron, weighed 25 
lbs.  With todays modern megnetic steels, the heating losses are 10% of 
that one, and it weights 6 lbs.  We've come a long way in my 81 years...

Cheers, Gene Heskett
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>

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


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

From"D'Arcy J.M. Cain" <darcy@VybeNetworks.com>
Date2015-12-24 14:09 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.124.1450984153.2237.python-list@python.org>
In reply to#100820
On Thu, 24 Dec 2015 17:30:08 +0000 (UTC)
Grant Edwards <invalid@invalid.invalid> wrote:
> And don't get me started on those people who use those "integrated
> circuits" instead of transistors, relays, and tubes...

Mmmm.  Tubes.  Still use them in my guitar amp.  Transistors just
aren't the same thing.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:darcy@Vex.Net VoIP: sip:darcy@VybeNetworks.com

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


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

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2015-12-24 18:55 -0500
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.139.1451001307.2237.python-list@python.org>
In reply to#100820
On Thu, 24 Dec 2015 17:30:08 +0000 (UTC), Grant Edwards
<invalid@invalid.invalid> declaimed the following:

>On 2015-12-24, D'Arcy J.M. Cain <darcy@VybeNetworks.com> wrote:
>
>> It reminds me of when one day people started claiming to be "building"
>> computers and they didn't even own a soldering iron.
>
>And don't get me started on those people who use those "integrated
>circuits" instead of transistors, relays, and tubes...

	Heck... I still have a handful of 5V TTL 74xx chips somewhere... I'm
still afraid of the CMOS variations because of all the warnings about
static back in the late 70s... {My first two pairs of shoes after
graduation and getting a job were >$100 [in 1980] Florsheim Imperials --
explicitly for the leather soles and heels, as leather was recommended for
its anti-static feature}. I used to toss half-inch (or longer on a bad day)
sparks reaching for the knob to the terminal room after picking up a
print-out from the other side of the building.

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


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

FromGregory Ewing <greg.ewing@canterbury.ac.nz>
Date2015-12-26 11:36 +1300
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<de5uneFjh4hU1@mid.individual.net>
In reply to#100820
Grant Edwards wrote:
> And don't get me started on those people who use those "integrated
> circuits" instead of transistors, relays, and tubes...

Transistors? You don't know how good you had it.
In my day we had to poke the dopant atoms into
the silicon one at a time with the point of a
needle.

-- 
Greg

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


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

FromGrant Edwards <invalid@invalid.invalid>
Date2015-12-31 16:46 +0000
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<n63m54$5e$3@reader1.panix.com>
In reply to#100863
On 2015-12-25, Gregory Ewing <greg.ewing@canterbury.ac.nz> wrote:
> Grant Edwards wrote:
>> And don't get me started on those people who use those "integrated
>> circuits" instead of transistors, relays, and tubes...
>
> Transistors? You don't know how good you had it.
> In my day we had to poke the dopant atoms into
> the silicon one at a time with the point of a
> needle.

You had needles?!

-- 
Grant

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


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

FromChris Angelico <rosuav@gmail.com>
Date2015-12-25 03:31 +1100
SubjectRe: Need help on a project To :"Create a class called BankAccount with the following parameters "
Message-ID<mailman.116.1450974699.2237.python-list@python.org>
In reply to#100807
On Fri, Dec 25, 2015 at 3:14 AM, D'Arcy J.M. Cain
<darcy@vybenetworks.com> wrote:
> It reminds me of when one day people started claiming to be "building"
> computers and they didn't even own a soldering iron.

Hey! Don't judge me just because I use my dad's! :)

ChrisA

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


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

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


csiph-web