This is my code

def **fifty_percent_off**(item):
  # Check if item.cost exists
  if hasattr(item, 'cost'):
    return item.cost / 2

  # If not, return None 
  return

sale_price = **return_half_of_cost**(product)

if sale_price is None:
  print("This product is not for sale!")

That would be the return even if no return statement is provided in the code, hence, default.

Not sure what the ** represents in the function name. Are they even valid characters?

File "<stdin>", line 1
    def **fifty_percent_off(item):
         ^
SyntaxError: invalid syntax

Since your code is testing whether the item has a cost attribute, would it not also make sense to test if the item exists? What is the name of data store structure? Given a data structure, products,

if item in products:
    if hasattr(item, 'cost')
1 Like