Please help me understanding the end=ā€˜ ā€˜ argument | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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