Back to questions
JuniorTheoryCommon
What does the program print (lines separated by spaces)?
print("a", "b", "c", separator: "-", terminator: "+")
print("d")a-b-c+d
- Expecting
a-b-c+anddon two lines:terminatorreplaces the line break instead of coming before it, so the nextprintcontinues the same line. - Expecting a separator after the last value too:
separatorgoes only between neighboring values, soa,bandcgivea-b-c.
- What would the program print if the first call had no
terminator:label? - How would you print
a,bandcglued together, with nothing between them?