Computer programs in any language consist of statements
. Every statement is like an order for
computer to do something specific, to execute some action.
Picture above shows some examples of such orders. Besides obvious cases like Bite or Sleep more complicated statements are possible, like Seek for the minimum of such and such function. Later we'll see also conditional statements like open an umbrella if it rains or with repeating action go to school every day until age of 18.
We'll start our journey with example of statement which prints something to the screen, or rather to the "output" area - as nowadays our computers show many things on a single screen simultaneously.
So the statement we want looks like word print
with parentheses (...)
immediately following. Everything
we want to be printed - we include into these parentheses.
Click (or tap) on the code below to copy it to execution area - this works with all code fragments in our lessons!
print(12345)
print('Hi, Aliens!')
Note that when we print number, we type it into parentheses as is, but if we want a text string, we should use quotes (single or double) on each side, so that computer is not confused if the text contains spaces, commands or other parentheses for example.
Exercise below requires you to write a program consisting of three print(...)
statements. Make them
print three words mentioned (so that each statement prints one of the words).