#WSQ 02 – Hello World

INSTALLING PYTHON ON MAC

Using a Mac really made this task pretty easy. First of all I just had to install Python3 using Homebrew: which in the Homebrew page just copy and paste the command line into your terminal:

ruby -e "$(curl -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"

Then in the terminal I typed in: brew install python3

THAT’S IT!

Just let Homebrew do the magic.

 

PRINTING ‘HELLO WORLD’

In order to print out ‘Hello World’ using Python3. First I created a folder in my desktop named “Python”, where I will keep all my ‘.py’ files.

In my text editor I created a new file in my “Python” folder and called it ‘hello.py’

Once I saved the file with the extension ‘.py’ my text editor automatically knew that it was a python file so when I typed:

print(“Hello World”)

My text editor identified the syntax and colored it.

Screen Shot 2016-01-22 at 3.14.41 PM

Now to actually print ‘Hello World’, I went back to my terminal looked for the “Python” folder and opened the ‘hello.py’ file

Screen Shot 2016-01-22 at 3.36.33 PM.png

First I had to open up my “Python” folder by using the ‘cd’ command to change the directory and follow the path to the folder which is ‘Desktop/Python’

Then use the ‘ls’ to see what is inside the “Python” folder, after that I told the terminal to use ‘python3’ to open the ‘hello.py’

And That’s It!….It printed ‘Hello World’!

CC BY-SA 4.0 #WSQ 02 – Hello World by kevingmcc is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.