Writing to Console (Printing)
Let’s start by doing a print statement. A print statement allows you to take control of the computer and make it print something out!
To start, copy and paste this text into your Repl.it main.py:
print("Hello, World!")
Then, click run.
Watch your console say “Hello, World!” on the screen to the right! print tells the computer to print the sentence within the parentheses ()
into the console window, or the screen on the right.
HELP! I got a lot of red text!
If you see any red text, you have encountered some errors! Please ask for help or check the debugging page at the end of the tutorial.
Some errors to be aware of:
- You have to put quotes around the sentence you want to print!
print(Hello, World!
)
print("Hello, World!"
)
Spacing is very important!
Make sure you don’t have any extra tabs or spaces at the beginning or end of each line.
Python won’t be able to read the code otherwise!