print() Flashcards
built-in function that prints/outputs specified message to screen/console window
print()
the monks and septans writing out letters to be delivered by crow
Built in funcions are always available
do not require import
https://docs.python.org/3/library/functions.html
To call a function (this process is known as function invocation or function call), you need to use the function name followed by parentheses.
print(“Hello,”, “world!”). An “empty” print() function outputs an empty line to the screen.
“I am a string” (double quotes), or ‘I am a string, too’ (single quotes).
Python strings are delimited with quotes
Collections of instructions - commands to perform specific tasks
instructions
backslash \ special character that anounces newline character
Lieutenant Backsight Forethought (BF)
\n
dictated by their position, e.g., the second argument is outputted after the first, the third is outputted after the second, etc.
positional arguments
kama sutra
arguments are the ones whose meaning is not dictated by their location, but by a special word (keyword) used to identify them.
keyword arguments
Holy See
keyword argument parameters can be used for formatting the output of the print() function
end()
sep()
Keyword argument 3 elements
keyword (id of argument) == end equal sign = value
must be place after the LAST positional argument
end and its rules
end=””
end=”***”
default behavior of end IMPLICITLY uses
end=”\n”
in a way that is not directly expressed
Varys
Littlefinger
Tyrion
something about print
is that hair gel
a print() function invoked with more than one argument outputs them all on one line;
the print() function puts a space between the outputted arguments on its own initiative.
keyword argument that separates its outputed arguments with spaces
sep
written as sep=”-“
print(“My”, “name”, “is”, “Monty”, “Python.”, sep=”-“)
My-name-is-Monty-Python.
Both the end and sep keyword arguments can be
mixed in one invocation
Keyword arguments are the ones whose meaning is not dictated by their location, but by a special word (keyword) used to identify them.
The end and sep parameters can be used for formatting the output of the print() function. The sep parameter specifies the separator between the outputted arguments, e.g., print(“H”, “E”, “L”, “L”, “O”, sep=”-“), whereas the end parameter specifies what to print at the end of the print statement.