Please help me understanding the end=‘ ‘ argument | Sololearn: Learn to code for FREE!

0

Please help me understanding the end=‘ ‘ argument

colors = ['red', 'yellow', 'orange'] for color in colors: if color != 'yellow': print(color, end='-') Why is the answer for this code: red-orange- and not: red-orange Isn’t the last end =‘-‘ (the right side of orange) only called when another value is added.

10/19/2021 7:46:52 PM

Jenkins

2 Answers

New Answer

+3

Jenkins The end parameter is used to append any string at the end of the output of the print statement in python. https://www.studytonight.com/post/the-sep-and-end-parameters-in-python-print-statement

0

The end parameter is used to append a string to the output of print() when printing of one statement is done.