xxxxxxxxxx
print("line one\nline two") # the \n in python is used to create new lines in a string
xxxxxxxxxx
# When you want to print in a new line you can write '\n' to indicate the start of the line
# Remember '\n' is one character not two
stuff1 = 'Hello\nWorld!'
print(stuff1) # Output: Hello
# World
stuff2 = 'X\nY'
print(stuff2) # Output: X
# Y
print(len(stuff2)) # Output: 3
xxxxxxxxxx
#code
print('characters after the Python new line character \n will be printed on a new line')
#output
characters after the Python new line character
will be printed on a new line
xxxxxxxxxx
#code
question = input('Name the character that prints string characters on a new line \n')
print(question)
if question == 'python newline character'
print('You're a genius!')
#output
Name the character that prints string characters on a new line
|