Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Solución de Problemas

con Programación
USING PYTHON
Python 3.6.4
http://www.python.org - Windows
Python 3.6.4 for Mac OS X
Ejecución de Python –
Ambiente de Desarrollo - IDLE
Ambiente de Desarrollo – IDLE
Python Interactive Shell
Python Script

Se sugiere guardar los archivos con un nombre que inicie con


letra y no tenga espacios. Ubicar el archivo en una carpeta en la
que no haya espacios para llegar a ella.
Python en la nube – Python Anywhere,
interactive mode
1) Go to pythonanywhere.com and click on “Pricing & Sign up” in the upper right. A free
beginner account is enough to get started.
Python-anywhere, interactive mode
2) Create a beginner account
Python in a browser, interactive mode
Fill the form
Python in a browser, interactive mode
After you create an account, you should see a page like this

A Python “console” is a window where you can execute Python commands


Python in a browser, interactive mode
2) Under “Start a new Console”, select “Python: 3.5” which will create a new console running
a current version of Python 3. The result should look like this:

3) Click on “Dashboard” in the upper right to see the new console under “Your consoles”:
Python in a browser, interactive mode
3) New console appears under “Your consoles”. Click on its name to use it.
Python in a browser, interactive mode
4) Optional: Nominate me as your “teacher” on PythonAnywhere. If you have questions, I might
be able to help, depending on my availability. If you nominate me, I will have access to the
consoles and files you create on PythonAnywhere, but I will not have any access to your
computer. If that sounds ok, click on the “Account” link in the upper right and then on the
“Teacher” tab.
Python in a browser, interactive mode
It should look like this:

Type my user name, “rodolfovaldez”, in


the text box, then press the check
button. I’ll get an email letting me know
that you’ve signed up. Return to Dashboard
and select the console to work in.
Step 2: Python in a browser, script mode
Running Python code in interactive mode is a good way to get started, but if you are working
with more than a few lines of code, it can be clumsy.
The alternative is to save code in a file called a script and use the interpreter to execute the
contents of the script. Here’s how to do that on PythonAnywhere.
1) Click on “Dashboard” in the upper right and elect the “Files” tab. It should look like this
Step 2: Python in a browser, script mode
The following will be displayed. Type a name for a directory in the text box that says “Enter new
directory name” , for example, type “initialExamples” and press “New directory” button.
Step 2: Python in a browser, script mode
2) Now you are in a new directory. You can upload a python file or create the program here. In
the text box that says “Enter new file name”, type a file name like hello.py. By convention,
filenames for Python scripts end in .py. Press “New file” button.

As a result a main window is displayed.


Step 2: Python in a browser, script mode
The main window is an editor where you can type Python code like the example below. When
you are ready to run, press the black button with the three angle brackets (>>>). The first time
you do this, your browser might ask whether to allow popups for this site. Say yes.
Step 2: Python in a browser, script mode
A new window should appear that shows the result of your program. Now you can edit and run
the program as many times as you like.
Step 2: Python in a browser, script mode
3) When you are done, press the InitialExamples directory and go back to the “Files”
tab. You should see the file you created on the list. It is already saved in the cloud. To
save the file in your disk, press the right button on the download icon and select “Save
link as…”. You can also edit, or delete the file using the corresponding icons.
If you go back to the
“Consoles” tab, you
might see a console
for the file you
edited. When you
are done working
with the file, you
can kill this console
(but your file will
still be there).
Step 2: Python in a browser, script mode
You can also upload a python file from your computer to pythonanywhere in the web. To
do that, press the upload button and select the file you want to upload.
References
Think Python 2e. http://www.allendowney.com/wp/books/think-python-2e/

You might also like