Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics Meet Python The Python Shell

python hello.ph

when i write print("hello world") and then on the console i write python hello.py it comes out hello world why not if i write hello_world.py shouldnt that work why only hello.py

3 Answers

Steven Parker
Steven Parker
231,248 Points

It sounds like "hello.py" is the name of the file that contains your code. If you don't also have a file named "hello_world.py", then telling Python to start a file with that name won't do anything.

Regardless of the file name what happens when you run it depends on the code inside the file.

if you want to print the same output hello world, using python hello_world.py command, change the filename hello.py to hello_world.py. Hope this helps.