+ 5
How do you make a code to output in a single line instead of separate lines? E.g 1 2 3 4(in python)
4 Respostas
+ 4
Using end =" "
I'm not good at explaining
This website explains better
https://www.geeksforgeeks.org/print-without-newline-JUMP_LINK__&&__python__&&__JUMP_LINK/
+ 4
for x in range(1, 5):
print(x, end=" ")
#Note that the value of end here is a whitespace and by default it is a newline or "\n" .
+ 4
+ 2
I know ruby has both puts and print function that differ in ways they output the result of the code