Skip to content

Exercise: Hello World

Leer en Español | Solve Online

Background/Motivation

In the long history of computer science, the "Hello World" program is the traditional first step for anyone learning a new language or exploring a new environment. Its purpose is simple: verify that you can correctly write code, run it, and see the expected output. In The Gymnasium, this exercise also ensures you understand how to use the SUBMIT flag.

The Task

Implement a function hello_world() that returns the exact string "Hello, World!".

Specifications

  • Function Name: hello_world
  • Arguments: None
  • Return Type: str
  • Expected Output: "Hello, World!"

Constraints

The output must match exactly, including capitalization and punctuation. No extra whitespace should be present.

Example

>>> hello_world()
'Hello, World!'

Instructions

  1. Open exercises/hello_world/solution.py.
  2. Implement the hello_world function.
  3. Change SUBMIT = False to SUBMIT = True at the top of the file when you are ready to be graded.
  4. Run python solution.py locally to verify your solution with the built-in self-tests.