Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Writing Your First Python Code | Getting Started with Python
Introduction to Python

bookWriting Your First Python Code

Deslize para mostrar o menu

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

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 2

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

Seção 1. Capítulo 2
some-alt