TC101

Bueno bueno, ahora es el momento de ser inspiradores y decir nuestras opiniones al respecto de lo que hacemos en este curso. Honestamente no soy buena explicándome en general, así que intentaré expresarme de la mejor manera posible.

Sobre el curso

El curso en general me encantó, ha sido muy productivo en mi opinión y esta bn diseñado, me gustó tener la oportunidad de tener un asesor que si me explicó las cosas y que tenga la capacidad de ir más allá del curso.

Sobre mi maestro

Me gustó mucho haber tenido la oportunidad de trabajar con Ken, al inicio estaba nerviosa al respecto, pero al iniciar el curso eso se fue. Yo veo a Ken como un maestro que es experto en su materia y que a parte de instruirnos en lo académico, nos da apoyo también en lo que necesitemos, y nos enseña sobre la vida, no solamente de lo académico, eso es lo que yo considero como un buen maestro, so Ken….you got A+++++++

 

Lo que pasa de vez en cuando

Hoy sucedió algo muy gracioso cuando intentaba entrar a un sitio web, el archivo no fue encontrado, pero…no salía la típica ventana que dice Error y un código que los mortales no entienden, sino que los diseñadores se molestaron en hacer una página para casos como esos. El link es: http://www.ibiblio.org/obp/thinkCSpy/chap11.htm#5

¿Qué tiene eso de interesante? todos lo idiomas que ponen y los dialectos

Echa un vistazo….

 

Referencias:

http://www.ibiblio.org/obp/thinkCSpy/chap11.htm#5

Jisho para tu, jisho para mua

Jisho 辞書, es la palabra japonesa para diccionario tranquilos, hoy no hablaré de cosas otakus…Hoy vengo a hablarles de los diccionarios en Python.

Un diccionario es similar a lo que en Java llamamos array, la diferencia radica en que podemos personalizar las keys  que son las posiciones, es decir los nombres de las keys no están limitadas a números, sino que puedes personalizarlas y ponerles el nombre que desees.

La segunda cosa son los niveles, no hay límite, es decir que puedes seguir y seguir guardando información en una key; ahora, ¿qué puedo guardar en una key? Puedes guardar lo que desees, inclusive objetos.

Ahora el formato, los diccionarios se ponen entre llaves ‘{}’ y para una posición específica de un diccionario se pone nombre[posición]

Aquí hay un ejemplo que Angel compartió en su blog

dictionary

Referencias:

http://www.tutorialspoint.com/python3/python_variable_types.htmhttps://angelmendozas.wordpress.com/2016/08/30/python-basic-types/

No, no es el de mate

Rangos, ¿qué es eso? Eso no es queso, es una función que crea sucesiones aritméticas. Así es como luce

range(m, n, k)

m es el punto de inicio

 es el límite superior, nunca se toca

es el espacio entre cada número

ahora que sabemos que es un rango ¿en qué se usa? la mayoría de veces se usa como interator en loops, sin embargo tiene mas aplicaciones dependiendo de lo que estés realizando

He aquí un ejemplo

ejemplo.PNG

Referencias:

Python’s range() Function Explained

https://geekytheory.com/la-funcion-range-en-python

I can read your mind

Reading files sounds very complicated, but is very easy an this GIF explains it very well

Reading-Text-File-Animation-s

And…what about if I want to make a list out of a bunch of words separated by a comma or semi-colon, well we have a GIF for explaining this, here you will use the split() method.

Reading-CSV-File-Animation-s

Here we have an example from our friends of 101Computing

The code below realizes 5 main steps:

  1. Step 1: Open the text file using the open() function. This function takes two parameters: The name of the file (e.g. “playlist.txt”) and the access mode. In our case we are opening the file in read-only mode: “r”.
  2. Read through the file one line at a time using a for loop.
  3. Split the line into an array. This is because in this file each value is separated with a semi-column. By splitting the line we can then easily access each value (field) individually.
  4. Output the content of each field using the print method.
  5. Once the for loop is completed, close the file using the close() method.

https://www.trinket.io/embed/python/2d1f14806c

Here we have the «modes» available for open() 

Mode Description
r Opens a file in read only mode. This is the default mode.
r+ Opens a file for both reading and writing.
w Opens a file for writing only. Overwrites the file if the file exists. If the file does not exist yet, it will create the new file for writing.
w+ Opens a file for both writing and reading. Overwrites the file if the file exists. If the file does not exist yet, it will create the new file for writing.
a Opens a file for appending. The file pointer is at the end of the file. So new data will be added at the end of the file. If the file does not exist, it creates a new file for writing.
a+ Opens a file for both appending and reading. The file pointer is at the end of the file. The file opens in the append mode. If the file does not exist, it creates a new file for reading and writing.

References:

http://www.101computing.net/python-reading-a-text-file/

You wanna try?

«Any program input such as a user typing at a keyboard or a network connection – can potentially be the source of security vulnerabilities and disastrous bugs. All input should be treated as potentially dangerous.

Determined attackers can use carefully crafted input to cause programs to run unauthorized commands. This technique can be used to delete or damage data, run malicious programs, or obtain sensitive information.»

This is the reason we need to validate the inputs we include in a program, so that when we «try» to do something we «catch» the errors, exceptions etc. For this we literally use the commands try and catch. Here is one example

https://www.trinket.io/embed/python/50ed4f51fd

Also, we need to be careful using this and be sharp enough for catching all the possible exceptions so that it is very difficult to find a «whole» in our code.

References:

http://www.101computing.net/number-only/

http://cis1.towson.edu/~cssecinj/modules/cs0/cs0-input-validation-python/