Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Need help on a project To :"Create a class called BankAccount with the following parameters " Date: Fri, 25 Dec 2015 00:10:17 +1100 Lines: 28 Message-ID: References: <5ec1d759-a2ab-4193-a4aa-869c0bf0506c@googlegroups.com> <1e0feecd-6292-406d-ac27-d32742a4023a@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de T6CFT2OmcIsHbcprCzwCIQnAdh3kEiapKsivANsXn22g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'debug': 0.04; '(b)': 0.07; 'subject:help': 0.07; 'cc:addr :python-list': 0.09; 'logic': 0.09; 'lost.': 0.09; 'subclass': 0.09; 'def': 0.13; 'subject: \n ': 0.15; 'thu,': 0.15; '11:59': 0.16; '24,': 0.16; 'bankaccount': 0.16; 'compile,': 0.16; 'correctly,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'operator;': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:class': 0.16; 'subject:parameters': 0.16; 'wrote:': 0.16; 'subject:project': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '(a)': 0.22; 'dec': 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'errors.': 0.27; '(c)': 0.29; 'transaction': 0.30; 'code': 0.30; 'class.': 0.30; 'post': 0.31; 'getting': 0.33; 'class': 0.33; 'quotes': 0.33; 'received:google.com': 0.35; "isn't": 0.35; 'step': 0.36; 'but': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; "won't": 0.38; 'received:209': 0.38; 'sure': 0.39; 'subject:the': 0.39; 'subject:with': 0.40; 'still': 0.40; 'some': 0.40; 'your': 0.60; 'challenge': 0.61; 'subject:Need': 0.61; 'complete': 0.63; 'balance': 0.64; 'due': 0.65; 'here': 0.66; 'lack': 0.76; 'chrisa': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=MrnyM/jJ8Qclaxx9WljoX7hZEqumUZsocEdk11ZPMRk=; b=BP5ojlsJ2rR6GcxEdVmoNDO8tUpvHz8afDPpIY5ctiMykWYRkCAStkA/Z3VeQ9n4M6 sFK/8UjlThVdmtAzafBupk+QtLHMVtoTbtn1ZkilX9z9mQMoE8tfe1dKZE/5i+i92vVJ sB63m4kOC9JjkkyF13cZvocjfGobdxs3fuyfPa3v8x4plLd6K89du19Z8Fs+rlE/3afA CLc2LQZ1WoYmuAnnGp/dxNwdTlfnswgP6hWsb1oVBqB+EJaQOMfKAEIGAlyGRk/rVsBI 9PQ3+tzXN1eNDNWeX46UfNycVyOVG0qKVpd2RXev0ZArmmA71dvqHC0RkAwxOs5PNed1 RUeg== X-Received: by 10.107.40.76 with SMTP id o73mr30764921ioo.157.1450962618007; Thu, 24 Dec 2015 05:10:18 -0800 (PST) In-Reply-To: <1e0feecd-6292-406d-ac27-d32742a4023a@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100799 On Thu, Dec 24, 2015 at 11:59 PM, 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