TEACH ME HOW TO BOT – Building a simple Twitter Bot

--Originally published at Coding The Future

Greetings everyone! I am back, and although this is long overdue, it's finally here!

Today I am releasing my tutorial on how to build a simple Twitter Bot. I have been working on a bot called Manny's Fortune Ball, a simple bot that replies with future predictions every time you ask it a question. You can go check it out by visiting its Twitter profile, and asking him a question. Its handle is @askemanuel.

Above I have attached a interactive slideshow. To move on to the next slide, just click on it, or tap the arrows.

Finally, this is the link to the GitHub repository so that you can check my source code: https://github.com/emamex98/TwitterFortuneBall

I hope you enjoy the tutorial! If you have any questions, do not hesitate to contact me:
Twitter: @emamex98
Email: em (at) nuel.xyz

comments powered by Disqus

Reto: Revisar Palindromos

--Originally published at Migue´s Blog

Este reto fue de los más complicados, consistía en revisar un texto y mostrar cuantos palindromos contiene, hubiera sido más sencillo si solo se analizaban palabras como:

Bob=boB

Pero también se tiene que analizar toda la frase para ver en donde inicia y en donde termina cada palindromo por ejemplo en:

Anita lava la tina=anita lava la tinA

captura-de-pantalla-de-2016-10-27-00-40-32

captura-de-pantalla-de-2016-10-27-00-40-50

captura-de-pantalla-de-2016-10-27-00-41-38

captura-de-pantalla-de-2016-10-27-00-47-56

Aquí se declaran todas las variables a utilizar a lo largo del programa, son muchas para no revolverlas entre ellas, se irán explicando conforme se utilicen

captura-de-pantalla-de-2016-10-27-00-48-17

Con esta parte se preparan las letras a analizar:

  • linea 16: se introduce la frase
  • 17: se cambian a minusculas las letras
  • 18: se eliminan los elementos de la lista “eliminar”
  • 20: se añade cada elemento a la lista “letras_espacios” incluyendo los espacios
  • 22: Se separan las palabras por espacios, lo que elimina a los espacios de la lista
  • 23: Añade cada palabra separada a una lista
  • 25: separa las palabras en letras y las añade a otra lista
  • 29: Voltea las letras

captura-de-pantalla-de-2016-10-27-00-48-48

En esta sección se analizan las letras para identificar los palindromos,

Se analiza cada letra de la lista de letras que tiene el orden correcto, con la lista de letras con el orden invertido, si las letras son iguales se añade esa letra a una lista de “palindromos”, si no se agrega un espacio para separar los palindromos ya identificados y se continuan analizando las siguientes letras.

captura-de-pantalla-de-2016-10-27-00-49-02

En esta parte ya se tienen todos los palindromos identificados, pero sin espacios, por ejemplo se imprimiria “anitalavalatina”

por lo que se comparan las letras de la lista “palindromos” con la de la lista “letras_espacios”, si son iguales los elementos se añade a la lista”palindromo_final”, si no es igual y en las lista “letras_espacios” no corresponde a un espacio se le

Continue reading "Reto: Revisar Palindromos"

NO STRINGS ATTACHED

--Originally published at Coding The Future

Photo by Everton Vila

Hey everyone! It's been so long since my last post, but trust me, there's reasons for my absence and I am back with exiting stuff.

To begin today's topic, I have another of my quick stories... Lately, my life has been overtaken by discernment confusion on what I want to do, what I must do, and what is expected of me. I don't think a lot people go through this kind of crisis as often as I do, but I think we've all been there at some point in our lives. How is this relevant? Again, it really isn't, but I wish I could just try things sometimes without any strings attached.

Oh, well. That was deep. But now let's focus on strings, yay!

What are strings?

As you may know from my previous posts on types, one of the most interesting and common types in programming languages are strings.

Strings are a literally a chain of characters of any type. So any text-based variable is a string. Strings can include numbers, but these are not treated like numbers, rather like labels. So if you declare two strings like "2" and "4" and try to multiply them, you will get an error, because you can't multiply text! Get it? String is just plain text.

Declaring strings

Declaring strings in Python could not be easier. All you need to do is declare a variable and assign it a value within quotation marks. Take a look:

firstName = "Emanuel"

Now, we can do all sorts of things with this string! We can print it, we can concatenate it (join it with another string), split it, you name it!

How can they be used?

As I just mentioned, strings can be pretty powerful. I know I said you Continue reading "NO STRINGS ATTACHED"

FOR ALL THOSE PROCRASTINATORS

--Originally published at Coding The Future

If you are reading this right now, you were probably procrastinating, and just started studying for tomorrow's test, right?

Well, as always, I've got you covered. Here's a quick video summary of what you need to know for the first partial. I hope things are not too strange.

Good luck!

I AIN’T GOT NO TYPE

--Originally published at Coding The Future

Image via GIPHY

Personally, I am not a rap fan, but again, I am making a reference to a song. This time, No Type by Rae Sremmurd came to mind when thinking about the different types of data you can work with on Python.

Even though we've already been working with them, let's discuss these data types in more detail...

  • Integers: They store a whole numeric value with no decimals, e.g.: 5.
  • Floats: They store a numeric value with decimals, e.g.: 23.43.
  • String: They store a string of characters of any type, e.g.: "Hello". Note that in Python there is no char (character) type. If you wanted to store only one character, use a string of length one. Also, just like it's name suggests, it is a string of characters tied together, so you can access each character using it's position. For example, in "Hello", string[1] is 'e'.
  • Booleans: They store a binary value of true or false. Basically, a variable of this type can only have a value of true or false. The false value can be expressed as 0, and true as any other number. E.g.: userIsMale = false.

Also, there are types in which several items can be stored within one variable. In other programming languages, they are usually called arrays, but in python they are somewhat different.

  • Lists: A list that stores several variables, and can be expansible. They are not limited to just storing one type of data; or in other words, you can store ints, strings, floats, in just one list. E.g.: list = [1, 2, hey, music, 12.34]
  • Tuples: Similar to a list, but static. Once it is declared, it remains fixed. E.g.: tuple = {1, 3, hello}

That's Continue reading "I AIN’T GOT NO TYPE"

I AIN’T GOT NO TYPE

--Originally published at Coding The Future

Image via GIPHY

Personally, I am not a rap fan, but again, I am making a reference to a song. This time, No Type by Rae Sremmurd came to mind when thinking about the different types of data you can work with on Python.

Even though we've already been working with them, let's discuss these data types in more detail...

  • Integers: They store a whole numeric value with no decimals, e.g.: 5.
  • Floats: They store a numeric value with decimals, e.g.: 23.43.
  • String: They store a string of characters of any type, e.g.: "Hello". Note that in Python there is no char (character) type. If you wanted to store only one character, use a string of length one. Also, just like it's name suggests, it is a string of characters tied together, so you can access each character using it's position. For example, in "Hello", string[1] is 'e'.
  • Booleans: They store a binary value of true or false. Basically, a variable of this type can only have a value of true or false. The false value can be expressed as 0, and true as any other number. E.g.: userIsMale = false.

Also, there are types in which several items can be stored within one variable. In other programming languages, they are usually called arrays, but in python they are somewhat different.

  • Lists: A list that stores several variables, and can be expansible. They are not limited to just storing one type of data; or in other words, you can store ints, strings, floats, in just one list. E.g.: list = [1, 2, hey, music, 12.34]
  • Tuples: Similar to a list, but static. Once it is declared, it remains fixed. E.g.: tuple = {1, 3, hello}

That's Continue reading "I AIN’T GOT NO TYPE"