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.

19th Oct 2021, 7:46 PM
Jenkins
2 Respostas
+ 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
19th Oct 2021, 7:58 PM
A͢J
A͢J - avatar
+ 1
The end parameter is used to append a string to the output of print() when printing of one statement is done.
20th Oct 2021, 5:28 AM
Prabhas Koya