Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Shmuel Zilberman
1,409 Pointspython 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

Henrik Christensen
Python Web Development Techdegree Student 38,319 PointsBecause the file is named hello.py, and for the hello_world.py to work you would need a file named hello_world.py

Steven Parker
216,017 PointsIt 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.

Deep Patel
7,347 Pointsif 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.