This Print Numbers lesson is for a beginner. Read the short notes, run each example, then change one name or number and run it again.
print writes numbers without quotes. A number inside quotes is text, so the plus operator joins text instead of adding.
Sep changes the gap between values. End changes what print writes after the last value.
Start here
print(20 + \"4\") fails because a number and text cannot be added.
print(20 + 4) # the math runs, then print shows the result
print(20, 24, sep="-") # sep sets the gap between values
Add, do not join
The first line adds numbers. The second line joins text, so you see 204.
print(20 + 4) # the math runs, then print shows the result
print("20" + "4") # plus joins text; use str() for a number
Choose the separator
sep replaces the space that print normally puts between values.
print(20, 24, sep="-") # sep sets the gap between values
Stay on one line
end=\": \" stops print from starting a new line, so 82 follows the label.
print("Score", end=": ") # end replaces the new line after this print
print(82)
