Last active
August 29, 2015 14:01
-
-
Save Theby/be574aa6583de3b5a724 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Realice la suma de dos números enteros que den como resultado: 42 | |
#Para esto tan solo elige dos números enteros y sumalos :) | |
#recuerda que el resultado debe ser 42 | |
>>> 13 + 29 | |
42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Calcule la cantidad de minutos que tiene un año de 365 días. | |
#Un día tiene 24 horas y una hora 60 minutos | |
#Al multiplicar estos números es posible obtener la respuesta | |
>>> 365 * 24 * 60 | |
525600 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Divida un múltiplo de 7 por un múltiplo de 3 obteniendo un resultado decimal. | |
#Nuestros numeros de ejemplo son 14 y 9, sin embargo si los dividimos directamente | |
#obtendremos un número entero | |
#FORMA INCORRECTA | |
>>> 14 / 9 | |
1 | |
#Por lo que uno de los dos debe ser decimal o float | |
#FORMA CORRECTA | |
>>> 14 / 9.0 | |
1.5555555555555556 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Transformar 200 metros/segundos a kilómetros por hora | |
#1 metro corresponde a 1/1000 kilometros | |
#1 segundo corresponde a 1/3600 horas | |
#por lo que para transformar metros a segundos debemos multiplicar 1 * (1 / 1000) | |
#y para pasar segundos a horas multipicamos 1 * (1 / 3600) | |
#Además debemos poner la distancia en el numerador y el tiempo en el denominador | |
#Finalmente transformamos un operando de cada division a decimal para obtener el | |
#resultado deseado | |
#FORMA INCORRECTA | |
>>> 200 * (1 / 1000) / (1 / 3600) | |
ERROR | |
#FORMA CORRECTA | |
>>> 200 * (1.0 / 1000) / (1.0 / 3600) | |
720.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Si una milla son 1.609344 kilómetros. ¿Cuántas millas son 70 kilómetros? | |
#Esto es una simple tabla de 3: si 1 es a 1.609344, x es a 70. | |
#multiplicamos cruzado y dividimos | |
>>> 70 / 1.609344 | |
43.495983456613374 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+--++-+-++-+--+42 ¿es positivo o negativo? | |
#Idealmente resolver esto a mano... Python nos dice que es negativo. | |
>>> +--++-+-++-+--+42 | |
-42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Usando paréntesis obtenga tres resultados diferentes de 8 + 4 * 3 + 5 * 3 * 4 + 1 - 3 | |
#Tan solo juega con los parentesis :) | |
>>> (8 + 4) * (3 + 5 * 3) * 4 + 1 - 3 | |
862 | |
>>> 8 + (4 * 3 + 5 )* 3 * (4 + 1) - 3 | |
260 | |
>>> (8 + 4) * (3 + 5 )* 3 * (4 + 1) - 3 | |
1437 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Respuestas a los ejercicios del tutorial de Python en:
www.estebangaete.cl/usach/tutoriales/python-usach/jugando-con-la-calculadora