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 trialShmuel 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,322 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
231,236 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.