domingo, 15 de enero de 2017

FIRST WORDS IN PYTHON 3

This post is about how to make your first "script" min python3 and to print it in your computer's terminal. (Only for mac users)


We will start with something easy and very common, the famous "hello world" line, but first you need to prepare your computer for this, which means you have to install the right softwares to make this run.

1.- You need to go to home brew (http://brew.sh) and copy the script line that appears on the main page.

2.- Open your Mac´s terminal and paste the script line which should look like this:


(It will start installing some packages and other stuff in your computer, which will be all necessary)

3.- After it finishes installing everything you should be able to type, so you´ll write "brew install python3".


4.- After it has finished, you'll need to go to your browser and look for atom, which is a text editor that will help you make your code. (https://atom.io)

5.- Now that you have atom installed, open it, go to "File" on the left top corner and choose "new file"

6.- Click on save as and name your file "hello.py", save it in your desktop. (we use ".py" to tell the computer that we´ll be writing in python)


7.- Type print ("Hello world") and save the file.

8.- Go to your terminal and type "cd Desktop", this because you were supposed to save the file in your desktop, and with this command the terminal will go to your desktop and look for any files that you have saved there.

9.- Now that you are in your desktop, you have to type "python3 hello.py" and the terminal will print the hello world phrase.



No hay comentarios:

Publicar un comentario