You are on page 1of 3

19/2/24, 20:05 Copia de Trabajo Autónomo Introducción python.

ipynb - Colaboratory

Puede apoyarse en el capítulo del libro para resolver los ejercicios:


https://www.py4e.com/html3/01-intro

keyboard_arrow_down Exercises
Exercise 1: What is the function of the secondary memory in a computer?

1. Execute all of the computation and logic of the program


2. Retrieve web pages over the Internet

3. Store information for the long term, even beyond a power cycle

4. Take input from the user

Exercise 2: What is a program?

Un programa es una secuencia de declaraciones en Python diseñadas para hacer resolver un


problemna en específico, incluso si es tan simple como imprimir un mensaje, como en el caso
del script hello.py.

Exercise 3: What is the difference between a compiler and an interpreter?

Un intérprete lee y ejecuta el código fuente de inmediato. Un compilador necesita el archivo


completo del programa antes de ejecutarlo, traduce el código de alto nivel a código de máquina
y luego lo coloca en un archivo separado para ejecutarlo más tarde.

Exercise 4: Which of the following contains “machine code”?

1. The Python interpreter

2. The keyboard
3. Python source file
4. A word processing document

Exercise 5: What is wrong with the following code: (NO RESPONDER)


💡 **Before resolving this exercise:** The symbol `>>>` is called “prompt” in the Interactive Python console.
The prompt indicates that Python is ready to accept code. By default, in Spyder the prompt looks like `In [1]:` .
To change the prompt, please follow these instructions:

1. On macOS, choose Preferences in the Python or Spyder menu. On Windows, choose


Preferences in the Tools menu.

https://colab.research.google.com/drive/1NfPw9amZjFkLxuPCqvEfsr-5zUZ2dSXH#printMode=true 1/3
19/2/24, 20:05 Copia de Trabajo Autónomo Introducción python.ipynb - Colaboratory

2. Inside the Preferences window, choose IPython console from the left-hand list of options.

3. Next, click the Advanced Settings tab, and scroll down to the section labeled Prompts.

4. In the box labeled Input prompt:, enter the following:

>>>

5. Restart Spyder

>>> primt 'Hello world!'


File "<stdin>", line 1
primt 'Hello world!'
^
SyntaxError: invalid syntax
>>>

Exercise 6: Where in the computer is a variable such as “x” stored after the following Python
line finishes?

x = 123

1. Central processing unit

2. Main Memory

3. Secondary Memory
4. Input Devices
5. Output Devices

Exercise 7: What will the following program print out:

x = 43
x = x + 1
print(x)

1. 43
2. 44

3. x + 1

4. Error because x = x + 1 is not possible mathematically

https://colab.research.google.com/drive/1NfPw9amZjFkLxuPCqvEfsr-5zUZ2dSXH#printMode=true 2/3
19/2/24, 20:05 Copia de Trabajo Autónomo Introducción python.ipynb - Colaboratory

https://colab.research.google.com/drive/1NfPw9amZjFkLxuPCqvEfsr-5zUZ2dSXH#printMode=true 3/3

You might also like