Help with 2/7


#1

def hotel_cost(night):

return 140 * nights
  • "Did you create a function called hotel_cost"..?

why does it state that?

Thanks in advance for any help:)


#2

The parameter in your function is 'night'. However you used 'nights' in your function code.


#3

My code is:

hotel_cost(nights):
return 140 * nights

and I am getting the same error message.


#4

:
def hotel_cost(n):
return n*140


#5

@bigdavidginola Just follow the instrucctions, I will coding for you step by step.

  1. Define a function called hotel_cost with one argument nights as input.

    def hotel_cost(nights):

  2. The (Here is your variable) hotel costs $140 per night

def hotel_cost(nights):
    hotel_cost = 140

2.1 So, the function hotel_cost should return 140 * nights.

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

:+1: The details are very importar when you are reading the instrucctinos :eyes:


#6

@mrugerio but I did this
def hotel_cost(nights):
return 140 * nights
and this work for me ?? why would it work different was can u explain please ??


#7

@ozdoglord is the same. I just followed the instructions textuality


#8

The code who is asking stay like this:
def hotel_cost(night):
return (140 * night)
print hotel_cost(5)

But, if you want to meke some more sophisticated you can do like this one:
def hotel_cost(n,d):
return (d * n)
print hotel_cost(5,140)

In that way you going to do a better instrument.


#9

thnk u so much it works finally :slight_smile: