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


Groups > comp.lang.python > #44626

Re: help..

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.009
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; 'exception.': 0.09; 'python': 0.11; 'def': 0.12; 'wrote': 0.14; 'answers:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function?': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'thu,': 0.19; 'seems': 0.21; 'error': 0.23; 'fine': 0.24; 'looks': 0.24; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '(which': 0.31; 'code': 0.31; 'getting': 0.31; "i'd": 0.34; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'how': 0.40; 'days': 0.60; "you're": 0.61; 'again!': 0.84; 'subject:..': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=hmDOLagout7ny0S9zzlHA89tqatXsrWIK1/xlcit1Ts=; b=LRfaKwYIASVAQkLKAGUOfOAMfI4PKRl/5UrWyN+NMh2aOxs7Qbn7jlAd9LYUxc34Tj +A/gOzcbZrS122TrqvQrVUUquO+RvydLfq1JYiEyQu3CH5VLwqzmTuSHuOmj/Ma/IQHI JH/9hDttGUe/+UZKGBdYKgWJUNFcqyXAKGE7c0WIy8ED4zgMbtQ2P2tAEq/Of9VQiARV I8m4vMtjMefU6tyzjvouKNL0jvzoRvUfuZaYAECLhA1ImvZ3iOpEkpkqoPfQ+kxLReyl iO/J2PaZEvKZfKp6Du9P0id/U9B/LiujCblJbRVxg+G6ABe3fjfRzOoP6rmYlgf+voGl /PXA==
MIME-Version 1.0
X-Received by 10.58.34.12 with SMTP id v12mr2166636vei.55.1367503571721; Thu, 02 May 2013 07:06:11 -0700 (PDT)
In-Reply-To <57E38A20-B52B-4CAE-B1FB-487DD99B48AD@icloud.com>
References <57E38A20-B52B-4CAE-B1FB-487DD99B48AD@icloud.com>
Date Fri, 3 May 2013 00:06:11 +1000
Subject Re: help..
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1238.1367503575.3114.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1367503575 news.xs4all.nl 15882 [2001:888:2000:d::a6]:43934
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:44626

Show key headers only | View raw


On Thu, May 2, 2013 at 11:56 PM, leonardo selmi <l.selmi@icloud.com> wrote:
> so i wrote the following code:
> def rental_car_cost(days):
>         cost = 40*days
>         if days >= 7:
>             return cost - 50
>         elif days >= 3 and days < 7:
>             return cost - 20
>         else:
>             return cost
>
> but it seems not to be right cause the computer answers: Oops, try again!
> Did you create a function called rental_car_cost?

That code looks fine to me (though I'd drop the "and days < 7" as it's
redundant); but the error you're getting isn't a Python exception.
What's giving that error? You may need to check the framing of your
code. How does codecademy (which I'm not familiar with) locate your
function?

ChrisA

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


Thread

Re: help.. Chris Angelico <rosuav@gmail.com> - 2013-05-03 00:06 +1000

csiph-web