Quiz 11

--Originally published at Python

El quiz 11, hasta el momento el quiz mas dificil de todos. Mas que nada por el largo. Empezemos con lo basico, las instrucciones.

Aqui esta el link para las instrucciones con ejemplos:

https://kenscourses.com/tc1014winter2017/wp-content/uploads/2017/03/TC101_FinalExamQuestions.pdf

1: Escribe el función distancia cual recibe 4 números (x1, y1, x2, y2) cuales representan dos puntos en espacio (x1,y1) y (x2,y2). El método debe regresar la distancia entre los dos puntos. Recuerda que el valor cuadrada del hipotenusa del triangulo es igual que la suma de las cuadradas de los otro dos lados del triangulo (the hypotenuse squared is equal to the sum of the squares of the other two sides).

2. (5 puntos) Escribe un función que se llama triangulo cual recibe un parámetro size y imprime un triangulo derecho como el siguiente. El renglón mas grande debe llevar size numero de “T”. SOLO imprime los “T”s y los endlines. Nota que no hay characteres (espacios) a la derecha de los T’s. Debe usar un ciclo “for” para controlar el repetición. Ejemplo es si size era 6

3. Escribe la función factorial cual recibe un entero “x” y regresa el valor de x! Recuerda que 0! = 1, 1! = 1, 2! = 2, 3!= 6, 4! = 24, etc. Para los de Python: NO PUEDES usar el factorial como parte del module “math”

4. Escribe una función que se llama promedio_lista que recibe un parámetro (una lista (Python) o arreglo/Vector de C++) de valores float y regresa como float el promedio de los números en la lista.

5. Escribe una función que se llama smallest_of_four cual recibe cuatro valores float como parametros y regresa el minimo (más pequeño) de los valores. Ojo: puede recibir unos valores iguales.

6. Escribe una función que se llama fibonacci cual recibe un número n

10 ganon
Continue reading "Quiz 11"

Advertencia

--Originally published at Python

Ninguna de las imagenes utilizadas en este blog me pertenecen. Asi como hago enfasis en que en su mayoria, pertenencen a los titulos:

The Legend of Zelda: Twilight Princess

The Legend oF Zelda: Wind Waker:

Por consecuencia, son propiedad de Nintendo y sus respectivas ramas. Este es un Blog con el proposito de ayudar a entender python asi como de registrar mi progreso personal, sin fines de lucro. Los links de los cuales obtuve las imagenes son los siguientes:

http://es.zelda.wikia.com/wiki/The_Legend_of_Zelda_Wiki

http://es.zelda.wikia.com/wiki/Princesa_Pose%C3%ADda

http://es.zelda.wikia.com/wiki/Pyrus

http://es.zelda.wikia.com/wiki/Stallord

http://es.zelda.wikia.com/wiki/Ganondorf_(Twilight_Princess)

 


WSQ 9

--Originally published at Python

“So for this assignment I would like to see you create a function that receives as parameter the name of a file (this would be a string value like data.txt) and your function counts the number of lines and the number of characters in the file which it returns as a single value (but with two values). You will want to look at how to use and return a tuple from a function and how to open and read text files line by line.”

En este programa, estableci 2 funciones: una para leer los caracteres en un texto (readi) y otra para leer lineas (readline1). Y para cada una asigne una funicon de python llamada “open()” la cual, aparentemente, busca en toda la computadora, puesto que no le asignas una carpeta especifica,  y abre el archivo, va seguida de funciones “r” para leer “e”para editar, etc. por ejemplo: open(“texto”, “r”). lo que hara es leer el archivo “texto” y lo leerá. Despues simplemente le asigne una variable contadora para los caracteres y otro para las lineas, despues solo imprimir las respectivas funciones y listo.


Mastery Topics

--Originally published at Python

  1. Use of comments
  2. Python conventions (Zen of Python but others for other languages)
  3. Basic types and their use
  4. Basic output (print)
  5. Basic user input (text based)
  6. Calling functions
  7. Creating functions
  8. Importing and using modules/libraries
  9. Creating and using your own modules/libraries
  10. Use of the conditional “if”
  11. Use of “else” with a conditional (and elif for Python)
  12. Nesting of conditional statements
  13. Use of loops with “while”
  14. Use of loops with “for”
  15. Use of recursion for repetitive algorithms
  16. When to use what type of repetition in a program
  17. Creation and use of Lists/Tuples in Python
  18. Creation and use of strings
  19. Validated user input (ensure correct/expected data entry)
  20. Reading and writing of text files
  21. Creation and use of ranges in Python
  22. Creation and use of dictionaries in Python

Quiz 5

--Originally published at Python

Para este “Quiz”, se nos informo que teniamos que empezar con los 46 ejercicios basicos de python, los cuales estan marcados con la historia de “The legend of zelda: Twilight Princess” en este blog. El link es: http://www.ling.gu.se/~lager/python_exercises.html. Los primeros cinco ejercicios son lo que cubren la cuota de este quiz.

Los cuales estan en este enlace: 1-5.