Feb-27-2019, 06:56 AM
Hey,
So I am doing exercises out of a Python book I am reading and for some reason this code is printing two new-lines between "- turkey" and "- bacon" and I was hoping someone could explain to me why this is:
So I am doing exercises out of a Python book I am reading and for some reason this code is printing two new-lines between "- turkey" and "- bacon" and I was hoping someone could explain to me why this is:
def order_sandwich(*items): for item in items: print("- " + item) order_sandwich('turkey') print("\n") order_sandwich('bacon', 'lettuce', 'tomato')When I write it like this, I only get one new-line, which is what I was expecting from the first snippet:
def order_sandwich(*items): for item in items: print("- " + item) order_sandwich('turkey\n') order_sandwich('bacon', 'lettuce', 'tomato')What am I missing?
