[Tutor] Codeacademy Problem

Joseph Parkton jparkton at gmail.com
Mon Apr 29 18:31:19 CEST 2013


Yupp I totally agree on the errors. I finally had to change the

    def hotel_cost(nights):
        nights = nights * 140
        return nights

to

    def hotel_cost(nights):
    return hotel_cost(nights) * 140

for it to work. Strange errors but decent exercises for beginners.


On Mon, Apr 29, 2013 at 10:01 AM, Chris “Kwpolska” Warrick <
kwpolska at gmail.com> wrote:

> On Mon, Apr 29, 2013 at 5:28 PM, Joseph Parkton <jparkton at gmail.com>
> wrote:
> > I tried both suggestions from Chris and I get Oops, try again! Did you
> > create a function called trip_cost? Not really sure why
>
> Your problem is: codecademy is dumb and its errors are, too.
>
> >>> def trip_cost(city, days):
> ...     totalCost = plane_trip_cost(city) + hotel_cost(nights) +
> rental_car_cost(days)
>
> There isn’t a “nights” parameter in your function, and you try to use
> it for hotel_cost().  Replace it with days.  And perform one of the
> variants, ending up with:
>
> def trip_cost(city, days):
>     return plane_trip_cost(city) + hotel_cost(days) + rental_car_cost(days)
>
> --
> Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
> stop html mail                | always bottom-post
> http://asciiribbon.org        | http://caliburn.nl/topposting.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130429/c661cbd9/attachment.html>


More information about the Tutor mailing list