Why does it print in the next line instead of continuing in the same line after coma? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does it print in the next line instead of continuing in the same line after coma?

def do_two(f): f() f() def do_four(f): do_two (f) do_two (f) def print_beam(): print ('+ - - -',) def print_post(): print ('| ',) def print_beams(): do_two(print_beam) print('+') def print_posts(): do_two(print_post) print('|') def print_row(): print_beams() do_four(print_posts) def print_grid(): do_two(print_row) print_beams() print_grid()

12th Dec 2016, 5:30 AM
Oleg Popov
Oleg Popov - avatar
3 Answers
0
use print(' your str hear', end='')
12th Dec 2016, 5:38 AM
Dilip Pandey
Dilip Pandey - avatar
0
becausw print works like this by default
12th Dec 2016, 6:31 AM
manish rawat
manish rawat - avatar
0
so what about this statement from the book:"If the sequence ends with a comma, Python leaves the line unfinished, so the value printed next appears on the same line."
12th Dec 2016, 10:01 AM
Oleg Popov
Oleg Popov - avatar