The basics of output

--Originally published at Codebuster

Fun fact: “Anything you view in your computer monitor is output”. That sounds a little bit intimidating, but in reality the basics of output can be fairly simple.

One of the first (if not the first) built-in classes people learn in any programming language is print. In fact, we have already worked with it in the Hello World program. Output is basically the computer communicating to us the results of what we aked the code to do. That easy program we made, already taught us output through print.

Print is useful when you want a value, variable, statement etc. in text. All you have to do is call the built-in class print and write what you want to be displayed (dont forget to put this between parenthesis). If it is a simple statement you should write it between brackets, but you can also define a variable and later ask the program to print it (notice that when we print variables we don’t use brackets). Even better, you can print several things at once:

output example1.PNG

And we get:

output in cygwin

Fun fact No.2, when you are using print if you write you code like this:

print (“Something”+variable)

The message will appear with no spaces between the words. However, if you write it as:

print (“Something”,variable)

5.gif
Automatically a space is left between the two values.