python tutorial for beginners #2: Hello World! @SafaaAlaa
python tutorial for beginners #2: Hello World!  @SafaaAlaa
Uploaded February 2016 | Updated November 2026, 2 days ago
python tutorial for beginners #2: Hello World!

Let’s get stuck in, and what better way than with the
programmer’s best friend, the ‘Hello World’ application!

Start by opening a terminal. Its current working directory will be your
home directory. It’s probably a good idea to make a directory for
the files we’ll be creating in this tutorial, rather than having them
loose in your home directory.

You can create a directory called Python using the command :
mkdir Python.

You’ll then want to change into that directory using the command
cd Python.

The next step is to create an empty file using the command
‘touch’ followed by the filename.
touch hello_world.py.

The final and most important part of setting up the file is making it executable. This allows us to run code inside the hello_world.py file. We do this with the command
chmod +x hello_world.py.

Now that we have our file set up, we can go ahead and open it up in nano, or any text editor of your choice. Gedit is a great editor with syntax highlighting support
that should be available on any distribution. You’ll be able to
install it using your package manager if you don’t have it already.


Our Hello World program is very simple, it only needs two lines.
The first line begins with a ‘shebang’ (the symbol #! – also known
as a hashbang) followed by the path to the Python interpreter.

#!/usr/bin/env python2


The program loader uses this line to work out what the rest of the
lines need to be interpreted with. If you’re running this in an IDE
like IDLE, you don’t necessarily need to do this.


The code that is actually read by the Python interpreter is only
a single line. We’re passing the value Hello World to the print
function by placing it in brackets immediately after we’ve called
the print function. Hello World is enclosed in quotation marks to
indicate that it is a literal value and should not be interpreted as
source code.

print(“Hello World”)

As expected, the print function in Python prints any
value that gets passed to it from the console.

You can save the changes you’ve just made to the file in nano
using the key combination Ctrl+O, followed by Enter. Use Ctrl+X
to exit nano.


You can run the Hello World program by prefixing
its filename with ./ – in this case you’d type:
./hello_world.py.


Subscribe for more:
----------------------------------------------------------------------------
youtube.com/subscription_center?add_user=saf3al2a

SWE.Safaa Al-Hayali - saf3al2a
python tutorial for beginners #2: Hello World!How to Hard Reset iPhone to Factory SettingsHow to Create Windows 10 Recovery DriveHow to Establish An OpenVPN Connection FREE in Ubuntu-15.10How To Install Windows 10 From USB | step by stepphp tutorial: foreach loop & each functionHow To Add Funds To Your Apple ID Using iTunes CardTransfer WhatsApp from iPhone to AndroidHow To Download And Install Visual Studio 2015 on Windows 10Android studio : How To Fix VT-x is disabled in BIOSlearn ajax : episode #2 : How to make synchronous XHR Request with JavaScript and AJAXHow to get FREE phone number
Safaa Al-Hayali (Safaa Alaa) |

python tutorial for beginners #2: Hello World!

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER