print() is the function to do output. 'Print' to the screen. Each value, either "string" or variable or expression is separated by a , comma: x = 3 print("hello", 5*x, x) #will output: hello 15 3 Notice the space between each value #More control over the output. Each numeric value must be converted to a string by str(): print("hello " + str(5*x) + " x=" + str(x)) #Same control, less syntax: use a "formatted string": starts with f, expressions/variables in {} print(f"hello {5*x} x={x}") #best?: f string with "field width" and/or "precision" (# decimal digits) # value of i in width of 5 (right aligned), value of x in width of 9 with 3 decimal digits print(f"hello{i:5} {x:9.3f}") {i:-5} left aligned print(f"{x:,}") #thousands comma print(f"{x:.2f}") #always 2 decimal digits even if 0 # another way to it: but avoid? # %5d means an int in field width of 5 # %9.3f means a float in field width of 9 with 3 digits to right of . #a feature of strings, not the print() x = 123.456789 i = 529 print("hello%5d %9.3f"%(i,x)) #after the string, must be % then parens list of variables #can't hide integer (part) digits #also: print("hello{:5} {:9.3f}".format(i,x)) # avoid? #control the end behavior, i.e. not the newline print("hello", end=" ") #4 spaces, no newline print("world", end="") #nothing at the end, no newline print() #typically then needed