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!
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
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
Henrik ChristensenPython Web Development Techdegree Student 38,322 Points
Because the file is named hello.py, and for the hello_world.py to work you would need a file named hello_world.py
Steven Parker228,001 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.