Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ Personal solutions to [**Python** track][python_track] exercises from [**Exercis

## Solutions

1. ["**Hello World**" solution](python\hello-world\hello_world.py).
<!-- Put next solution item here! -->

[python_version_badge]: https://img.shields.io/badge/Python%203.13-3776AB?logo=python&logoColor=FFD43B
[track_completion_badge]: https://img.shields.io/badge/Track%20completion-0.0%25-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[exercises_completed_badge]: https://img.shields.io/badge/Exercises%20completed-0%2F146-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[track_completion_badge]: https://img.shields.io/badge/Track%20completion-0.7%25-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[exercises_completed_badge]: https://img.shields.io/badge/Exercises%20completed-1%2F146-604fcd?logo=exercism&logoColor=604fcd&labelColor=e9ecef
[python_track]: https://exercism.org/tracks/python
[exercism]: https://exercism.org
45 changes: 45 additions & 0 deletions python/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Hello World

Welcome to Hello World on Exercism's Python Track.

## Instructions

The classical introductory exercise.
Just say "Hello, World!".

["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.

The objectives are simple:

- Modify the provided code so that it produces the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.

If everything goes well, you will be ready to fetch your first real exercise.

[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program

## Source

### Created by

- @michaelem

### Contributed to by

- @behrtam
- @cmccandless
- @Dog
- @hebertjulio
- @ikhadykin
- @kytrinyx
- @N-Parsons
- @NobbZ
- @pheanex
- @skeskali
- @Sukhj1nder
- @tqa236

### Based on

This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
2 changes: 2 additions & 0 deletions python/hello-world/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def hello():
return 'Hello, World!'
30 changes: 30 additions & 0 deletions python/hello-world/hello_world_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/hello-world/canonical-data.json
# File last updated on 2023-07-19

import unittest

try:
from hello_world import (
hello,
)

except ImportError as import_fail:
message = import_fail.args[0].split("(", maxsplit=1)
item_name = import_fail.args[0].split()[3]

item_name = item_name[:-1] + "()'"

# pylint: disable=raise-missing-from
raise ImportError(
"\n\nMISSING FUNCTION --> In your 'hello_world.py' file, we can not find or import the"
f" function named {item_name}. \nThe tests for this first exercise expect a function that"
f' returns the string "Hello, World!"'
f'\n\nDid you use print("Hello, World!") instead?'
) from None


class HelloWorldTest(unittest.TestCase):
def test_say_hi(self):
msg = "\n\nThis test expects a return of the string 'Hello, World!' \nDid you use print('Hello, World!') by mistake?"
self.assertEqual(hello(), "Hello, World!", msg=msg)
Loading