# This is a comment.
# python editor
# https://repl.it/languages/python3'''
This is not a
multi line comment (also tripple double-quotes).
This is still compiled by the interpreter.
But unless assigned to a variable, it is immediately garbage collected.
https://www.codecademy.com/forum_questions/505ba3cfc6addb000200e33c
'''# https://docs.python.org/3/library/functions.html#print
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)The print function prints the objects received as arguments to a stream (like STDOUT). They can be separated by a string (sep) and ended with a string (end). The sep, end, file and flush, if present, must be given as keyword arguments.
# single argument
print(123)
# => 123
print("Hello World!")
# Hello World!
# multiple arguments
print("Hello", "World!")
# => Hello World!
# custom separator
print("Hello", "World!", sep=" - ")
# => Hello - World!
# operations
print(1 == 1)
# => True
print( 1 != 1 )
# => False
print( 4 * 2 )
# => 8
# variables
a, b = 4, 2
print( "a * b =", a * b )
# => a * b = 8https://docs.python.org/3/tutorial/inputoutput.html
print( "%d * %d = %d" %( a, b, (a * b) ) )
# => 4 * 2 = 8https://docs.python.org/3/library/string.html#format-string-syntax
# sequential order
print("{} * {} = {}".format( a, b, a * b ))
# => 4 * 2 = 8
# indexed values
print("{2}, {1} and {0}".format("Italy", "Mercedes", "Pizza"))
# => Pizza, Mercedes and Italy
# named values (all or mixed values)
print("{food}, {1} and {0}".format("Italy", "Mercedes", food="Pizza"))
# => Pizza, Mercedes and Italy
# width and precision
a, b = 4, 2
print( "a * b = {:10.2f}".format( a * b ) )
# => a * b = 8.00
The \ character is used to put sequential code on the next line.
a, b = 1, 2
c = a + \
b
print( "c =", c )
# => c = 3