From 47803c2f549a6f4c8cda33ced7f9cb3ac6d6a962 Mon Sep 17 00:00:00 2001 From: Junior Date: Mon, 3 Jun 2024 19:08:22 -0400 Subject: [PATCH] Explain how to control line endings in a print() --- Python/000_basics.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Python/000_basics.py b/Python/000_basics.py index edf6c99..90f994c 100644 --- a/Python/000_basics.py +++ b/Python/000_basics.py @@ -3,6 +3,12 @@ # We show output in the terminal to a user with the "print" function print("Hello world!") +# By default, print() will put a new line at the end of ever print. +# If you want to stay on the same line (so you can add to it later) +# you must change the end character to be blank +print("This is on a line.", end='') +print(" This is on the same line!") + # This is a variable. A variable holds information like a string (letters and such), # integers (whole numbers), arrays and objects (discussed later) # Our first "string"