Download Introducción a la Computación (Matemática) - Clase 0

Document related concepts
no text concepts found
Transcript
Introducción a la Computación
(Matemática)
Clase 0
Lic. Ernesto Mislej
[email protected]
Departamento de Computación - FCEyN
17 de marzo de 2014
Linux TuX
Entorno Linux
Abramos una terminal y veamos los siguientes comandos:
passwd
ls
mkdir, rmdir
cat, less
rm
man
vim
chmod
Python
Hola mundo
Nuestro primer programa
$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license"
for more information.
>>> print "Hola Mundo"
Hola Mundo
>>>
Intérprete python
Python es un lenguaje interpretado
2
SOURCE
CODE
SOURCE
CODE
Chapter 1. The way of the progr
Chapter 1. The way of the program
OUTPUT
INTERPRETER
INTERPRETER
OUTPUT
ure 1.1: An interpreter processes the program a little at a time, alternately reading li
1.1: An interpreter
processes the
program a little at
a time, alternately
reading
lines
...a Figure
diferencia
de lenguajes
compilados
como
C, C++,
Java
d performing
computations.
and performing computations.
SOURCE
CODE
SOURCE
COMPILER
CODE
COMPILER
OBJECT
OBJECT
CODE
CODE
EXECUTOR
OUTPUT
EXECUTOR
OUTPUT
Figure 1.2: A compiler translates source code into object code, which is run by a hardware
executor.
ure 1.2: A compiler translates source code into object code, which is run by a hardw
Hola mundo v2
Crear un archivo holamundo.py e incluir el comando
print "hola mundo"
$ vim holamundo.py
Salir con ESC : wq!
$ python holamundo.py
Hola mundo v3 - Shebang
Incluir la siguiente línea
#!/usr/bin/env python
print "Hola Mundo"
Agregar permisos de ejecución
$ chmod 755 holamundo.py
$ ./holamundo.py
hola mundo