Apr-20-2020, 08:41 PM
Or,
def square(number): return number*number for num in range(1,10): print(square(num), end=', ') print(square(10))The end= parameter makes it so the print statement puts a comma and space after each number. You don't want to do that for the last item so it is handled as a special case.