Showing error in syntax


#1



showing invalid syntax at line 24


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:
        return Cost-=50
 elif days>=3:
        return Cost-=20
 elif days>=1:
      return Cost

Replace this line with your code.


#2

Have a look at here:

if days>=7:
    return Cost-=50

Cost -= 50 is a shorter way to type Cost = Cost - 50, and you can't do that when you return value of a function, right? :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.