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


Groups > comp.lang.python > #44626

Re: help..

References <57E38A20-B52B-4CAE-B1FB-487DD99B48AD@icloud.com>
Date 2013-05-03 00:06 +1000
Subject Re: help..
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1238.1367503575.3114.python-list@python.org> (permalink)

Show all headers | 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