PCEP:M2 - Print Function
keyword argument last value position
A ke____________ argument consists of three elements: a ke_____________ identifying the argu_________________ (end here); an equ__________ sign (=); and a valu______________ assigned to that argument; any ke_______________ argu______________ have to be put after the la_______________ posi_____________ argu_______________ (this is very important)
argument space
A print() function invoked with more than one argu______________ outputs them all on one line; the print() function puts a spa__________________ between the outputted argu_________________ on its own initiative.
effect result argument number zero
As we said before, a function may have : an eff___________; a res___________. There's also a third, very important, function component - the argu___________(s). Mathematical functions usually take one argument, e.g., sin(x) takes an x, which is the measure of an angle. Python functions, on the other hand, are more versatile. Depending on the individual needs, they may accept any nu______________ of arguments - as many as necessary to perform their tasks. Note: any number includes ze_____________ - some Python functions don't need any argument.
new
As you can see, the empty print() invocation is not as empty as you may have expected - it does output an empty line, or (this interpretation is also correct) its output is just a n__________-line.
characters positional arguments
As you can see, the end keyword argument determines the chara_____________ the print() function sends to the output once it reaches the end of its posit_____________ argum_____________. The default behavior reflects the situation where the end keyword argum_____________ is implicitly used in the following way: end="\n".
imported 69
Built-in functions, contrary to user-defined functions, are always available and don't have to be impor__________. Python 3.8 comes with ___(#2) built-in functions.
parentheses arguments parentheses
In spite of the number of needed/provided arguments, Python functions strongly demand the presence of a pair of paren__________________ - opening and closing ones, respectively. If you want to deliver one or more argu__________________ to a function, you place them inside the paren__________________ . If you're going to use a function which doesn't take any argu__________________ , you still have to have the paren__________________ .
ordinary function parentheses
Note: to distinguish ordi__________________ words from funct__________________ names, place a pair of empty paren__________________after their names, even if the corresponding function wants one or more arguments. This is a standard convention.
Positional location word identify
Posit____________ arguments are the ones whose meaning is dictated by their posit____________, e.g., the second argument is outputted after the first, the third is outputted after the second, etc. Keyword arguments are the ones whose meaning is not dictated by their loca____________, but by a special wor____________ (key____________) used to identify them.
delimited quotes
Python strings are delim____________ with quo______________, e.g., "I am a string" (double quotes), or 'I am a string, too' (single quotes).
one instruction line empty prohibited across complex
Python's syntax is quite specific in this area. Unlike most programming languages, Python requires that there cannot be more than on___________ instruction in a li____________. A lin__________ can be emp____________ (i.e., it may contain no instruction at all) but it must not contain two, three or more instructions. This is strictly prohi______________. Note: Python makes one exception to this rule - it allows one instruction to spread acro___________ more than one line (which may be helpful when your code contains comp__________ constructions).
formatting between outputted print
The end and sep parameters can be used for forma____________ the output of the print() function. The sep parameter specifies the separator betw____________ the output____________ arguments (e.g., print("H", "E", "L", "L", "O", sep="-"), whereas the end parameter specifies what to pri____________ at the end of the pri____________ statement.
keyword position
The mechanism is called ke___________ arguments. The name stems from the fact that the meaning of these arguments is taken not from its location (posi________) but from the special word (ke_____________) used to identify them.
end
The print() function has two keyword arguments that you can use for your purposes. The first of them is named en_______.
positional
The way in which we are passing the arguments into the print() function is the most common in Python, and is called the positi__________________ way (this name comes from the fact that the meaning of the argument is dictated by its posi________________
print function context
The word pri___________ that you can see here is a func___________ name. That doesn't mean that wherever the word appears it is always a function name. The meaning of the word comes from the con___________ in which the word has been used.
types
We'll show you soon that print() is able to operate with virtually all ty___________ of data offered by Python. Strings, numbers, characters, logical values, objects - any of these may be successfully passed to print()
separator empty string
We've said previously that the print() function separates its outputted arguments with spaces. This behavior can be changed, too. The keyword argument that can do this is named se_______ (like separ________________). Note: the se______________ argument's value may be an emp______________ stri______________________, too. Try it for yourself.
instructions command task backslash next character meaning
Computer programs are collections of instru____________. An instru____________ is a com____________ to perform a specific ta____________ when executed, e.g., to print a certain message to the screen. In Python strings the bac____________ (\) is a special character which announces that the nex____________ chara____________ has a different mean____________, e.g., \n (the newline character) starts a new output line.
string order previous
Each print() invocation contains a different str____________, as its argument and the console content reflects it - this means that the instructions in the code are executed in the same ord___________ in which they have been placed in the source file; no next instruction is executed until the previ_____________ one is completed (there are some exceptions to this rule, but you can ignore them for now)
double
If you want to put just one backslash inside a string, don't forget its escaping nature - you have to dou_____________ it
legal data requirements function effect result code resumes
What happens when Python encounters an invocation like this one below? function_name(argument) First, Python checks if the name specified is leg_______________ (it browses its internal da____________ in order to find an existing function of the name; if this search fails, Python aborts the code); Second, Python checks if the function's requi___________________ for the number of arguments allows you to invoke the function in this way Third, Python leaves your code for a moment and jumps into the func_________________ you want to invoke; of course, it takes your argument(s) too and passes it/them to the function; Fourth, the function executes its co_________________ , causes the desired eff_________________ (if any), evaluates the desired res_________________ (s) (if any) and finishes its task; Finally, Python returns to your code (to the place just after the invocation) and resu___________________ its execution.
arguments converts readable output device console
What is the effect the print() function causes? The effect is very useful and very spectacular. The function: takes its argu______________ (it may accept more than one argu____________ and may also accept less than one argu___________) conv____________ them into human-read_____________ form if needed (as you may suspect, strings don't require this action, as the string is already readable) and sends the resulting data to the out_____________ devi_____________ (usually the cons_____________ ); in other words, anything you put into the print() function will appear on your screen.
added modules write names
Where do the functions come from? They may come from Python itself; the print function is one of this kind; such a function is an ad___________ value received together with Python and its environment (it is built-in); you don't have to do anything special (e.g., ask anyone for anything) if you want to make use of it; They may come from one or more of Python's add-ons named mod___________; some of the mod___________ come with Python, others may require separate installation - whatever the case, they all need to be explicitly connected with your code (we'll show you how to do that soon);
coded executed data
You can imagine that the quotes say something like: the text between us is not co__________________. It isn't intended to be exe__________________, and you should take it as is. Almost anything you put inside the quotes will be taken literally, not as code, but as da_______________. Try to play with this particular string - modify it, enter some new content, delete some of the existing content.
