Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Writing Your First Python Code | Getting Started with Python
Practice
Projects
Quizzes & Challenges
Quizzen
Challenges
/
Introduction to Python

bookWriting Your First Python Code

Veeg om het menu te tonen

1
print('Hello, World!')
copy

Step-by-Step Breakdown: Printing 'Hello, World!'

Let's look at the code sample:

print('Hello, World!')

Here's what each part of this line does:

  1. print

    • This is a built-in Python function. It tells Python to display something on the screen.
  2. Parentheses ()

    • Functions in Python use parentheses to enclose their arguments. Here, the parentheses surround the message you want to display.
  3. Quotation marks ' '

    • In Python, anything inside single (' ') or double (" ") quotes is considered a string—a sequence of characters (text).
  4. 'Hello, World!'

    • This is the string you want to display. You can replace it with any text you like.

When you run this code, Python will output:

Hello, World!

This is often the very first program written when learning a new programming language. It demonstrates how to use the print function to show information on the screen.

Now it's your turn! Try writing your own greeting message in Python. For example, you could print your name or a fun message. Type your code below using the print() function.

question mark

Which of the following is the correct way to print 'Hello, World!' in Python?

Select the correct answer

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 2

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Sectie 1. Hoofdstuk 2
some-alt