Learn to Code via Tutorials on Repl.it!

← Back to all posts
The print function explained
IndyRishi (79)

Hello! This is a Python tutorial by IndyRishi. Before you start, make sure you have a blank REPL open.
Type print("Hello World!!") into the left side of the screen. Press the run button. What does it do?
It should say Hello World!!.

If it doesn't, make sure everything is spelled correctly. What's happening here?
It is writing the text that is in the quotation marks onto the console which is the right side. Text in Python is called a string or str(). A string has either apostrophes (') or quotation marks (") surrounding it. You can also print numbers. Numbers in Python are either called integers, int(), or floats, float().
An integer is a whole number. A float is a number with decimals. You can use int(), float(), and str() in your code.
You can convert decimal numbers to whole numbers and vice versa. You can use print to do math.
Try typing print(9+1). It should print 10. Below is a chart for the common math symbols.
//(division where the answer is converted to an integer)
==(equal to)
!=(not equal to)

(greater than)
<(less than)
<=(less than equal to)
=(greater than equal to)
We can also use variables with the print function. Like this:

Kookiez (305)

you can use markdown to make code blocks and stuff HERE.