5. Exit Commands

5.1. End-of-line character

  • The print command adds a line break as a character by default.

  • The end-of-line character can be replaced using end in the print command.

1for x in "avocado":
2    if x in "ae":
3        print(x, end=" ")
4    else:
5        print("*", end=" ")
line that just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Activity: CodeLens 5.1.1 (cl_l40_5_en)

You have attempted 1 of 2 activities on this page