2.1.1.8 Your first program
he print() function
Three important questions have to be answered as soon as possible:
1. What is the effect the
print()
function causes?
The effect is very useful and very spectacular. The function:
- takes its arguments (it may accept more than one argument and may also accept less than one argument)
- converts them into human-readable 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 output device (usually the console); in other words, anything you put into the
print()
function will appear on your screen.
No wonder then, that from now on, you'll utilize
print()
very intensively to see the results of your operations and evaluations.
2. What arguments does
print()
expect?
Any. We'll show you soon that
print()
is able to operate with virtually all types of data offered by Python. Strings, numbers, characters, logical values, objects - any of these may be successfully passed to print()
.
3. What value does the
print()
function evaluate?
None. Its effect is enough -
print()
does not evaluate anything.
Comments
Post a Comment