Explanation please on 4. Transportation


Exercise 4/7

My code is correct but l don't understand why the output of this code is none.
Is it supposed to act that way by returning none to the console?

I thought we had to input something to make it work, instead the code bypasses all the methods and passed it correct with the output 'none'.

Can someone please explain? :slight_smile:

def hotel_cost(nights):
  return 140 * nights
def plane_ride_cost(city):
  if city == "Charlotte":
      return 183
  elif city == "Tampa":
      return 220
  elif city == "Pittsburgh":
      return 222
  elif city == "Los Angeles":
      return 475
def rental_car_cost(days):
  cost = 40 * days
  if days >= 7:
      cost -= 50
  elif days >= 3:
      cost -= 20
  return cost


Moreover this next exercise on 5. Pull it together has the same output like the exercise before.

Can someone explain to me for this as well? :slight_smile:


None of your functions gets called, so they don't execute (function only execute when called). So nothing happens, so none gets printed at the console.


Thanks, I just figured it out now when l just completed the last exercise of this code and it finally outputs what its supposed to be, thank you again for mentioning it though. :slight_smile: