Print a Message
Everybody, say "Hello!"
Let's look at some basic Python statements. In the code editor window to the right of this tutorial page, you'll see the following code:
# Lesson 1: print() function
print('Hello, Buzz Coder!')
print()
print('Hello, CodeCraft!')
Click the run
button at the top. In the console window below the code editor, you will see this text:
Hello, Buzz Coders!
Hello, CodeCraft!
print()
is one of Python's many built-in functions. By its name, you might think it would send something to a printer, but its job is actually to show data onto the screen. When you write print()
, you are calling a function.
Here, the contents in the parentheses are called parameters or arguments. In the second print()
function, the empty parentheses mean there are no parameters, so it prints out a blank line.
The parentheses are always required when calling a function in Python, even if there are no parameters.
Now let's write some code. At the end of the file, start a new line, add a print()
statement to print out your own name: Hi, my name is ____.
Make sure that you begin your
print()
statement at the very beginning of the line, without spaces.
Run the program again to see your message. It should look like this:
Hi, my name is Buzz.