def buy(product, num, price): if check(product, num): products[product] -= num print(f'You bought {product} and spent {num * price}') else: print(f'Sorry! We are out of "{product}".')
def buy(product, num, price): global products if check(product, num): print(f"You bought {product} and spent {num*price}") products[product] -= num else: print("Sorry! We are out of this product.")
def buy(product,num,price): if check(product,num)==True: return(f"You bought {product} and spent {num*price}") else: return("Sorry! We are out of this product")
def buy(product, num, price): if check(product, num): print("You bought %s and spent %s" % (product, num * price)) else: print("Sorry! We are out of this product.")
def buy(product:str, num:int, price:float): if not check(product,num): print("Sorry! We are out of this product.") else: print("You bought %s and spend %s" %(product,num*price))