# 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:
Email: em (at) nuel.xyz

# Lists and Tuples

--Originally published at Hackerman&#039;s house

I review this topic with my good friend Sebastian Cedeño, we read a lot about this topic and made this really cool post. So bad that I had to finish it and upload it, so im doing this really late in friday night. There is a little bit of regreat in this words, but i’m also happy that I could finish this partial just as planned. Also check out Cheba’s blog: https://chebasquared.wordpress.com/

Lists and Tuples are sequenced types of data so called because they behave like a sequence.  This type of data is different than the numeric data because they are made of smaller elements that are put together. The elements that are inside a List or a Tuple can be almost any type of data, like a string, a numeric value even another list or tuple.

Define a list is really simple. Its similar to a string just that in this case we dont use ”, we use  square brackets. []

ListExample = [2, “Chema “, 3, “Paco “, (“Perro”, “Gato”)]

A tuple is almost the same as a list, the main difference between this two is that a list can be updated and modified, and a tuple cant be moddified once it has been defined. This means that the original values that are inside a Tuple will be there forever. Also the way that they are defined is a little bit different. While lists use square brackets, Tuples use parenthesis ().

TupleExample = (6, 9, “Clase “, [“Tarde “, “Dr. Strange “])

You can do many things with these type of data, for example you can select a certain element that is inside the list or tuple. In the following example you will get the first element on the list, the first element has a

# Métodos para listas

--Originally published at Eduardo&#039;s Projectz

Dentro de las listas existen varios métodos y funciones que se utilizan para obtener un mayor beneficio de estas.

Las principales funciones son:

len()

Se utiliza para conocer la longitud total de una lista.

Para utilizarse, simplemente se escribe “len” y entre paréntesis el nombre de la lista que deseas.

Nótese que esto te da la longitud, no la última posición que sería, en este caso, el 2.

append()

Se utiliza para añadir un valor al final de una lista, este valor tiene que ser del mismo tipo de dato que la lista.

Para utilizarse, escribe el nombre de la lista seguido por “.append” y, entre paréntesis, el valor que deseas añadir.

insert()

Este método permite añadir un valor a la lista en una poción determinada.

Para utilizarse, escribe el nombre de la lista seguido por “.insert” y, entre paréntesis, la posición en donde deseas poner un valor seguido de el valor, separados por una coma.

remove()

Esto se utiliza para quitar un valor existente en una lista.

Para utilizarse, se escribe el nombre de la lista seguido por “.remove” y el valor que se desea remover entre paréntesis.

index()

Esto se utiliza para conocer en que posición se encuentra un determinado valor.

Para utilizarse, se escribe el nombre de la lista seguido por “.index” y el valor que se desea conocer entre paréntesis.

Para más información en el tema, visita: https://docs.python.org/2/tutorial/datastructures.html

O si prefieres un video: https://youtu.be/zEyEC34MY1A

# I HAVE NO IDEA OF WHAT THIS IS…

--Originally published at Coding The Future

Picture by Syd Wachs.

Yup... I really don't. Thankfully I was able to find it on my dictionary, and I can now explain to you what a dictionary in Python is.

Remember lists and tuples? Dictionaries are very similar, only that this time, indexes have names, and can hold several types of information within one variable. Little confused? So was I... Here's an example.

#### Declaring Dictionaries

Let's say I wanted to create a dictionary with all of my personal information, instead of having a single variable for each thing. This is what it would look like:

`myInfo = {'Name': 'Emanuel', 'Age': 18, 'University': 'Tec de Monterrey'}`

As you can see, declaring a dictionary is quite easy. All I did was to begin with the dictionary's name, and then I assigned values inside of curly brackets. Inside of the brackets, I start by naming the first index Name, and declared the value after the colon. The second index comes after the coma, and if you pay close attention, you'll notice it is not a string, like the first and last index. That's because dictionaries can have several types, unlike lists and tuples.

Therefore, if I wanted to print my name from the dictionary, here's what I would do:

`print(myInfo[Name])`

Notice how I use the index name and not its number. That's what makes dictionaries different from lists and tuples.

Dictionaries can come in handy when you are dealing with information that can be identified with a name easier than with a number. If you want to learn more ways of how you can use them, be sure to check this tutorial by TutorialsPoint and this one Learn Python The Hard Way –they both really helped me!

That's it for today! Stay tuned for exiting content about bots coming up next Continue reading "I HAVE NO IDEA OF WHAT THIS IS…"

# TUPLE UP! – Diving deeper into Lists and Tuples

--Originally published at Coding The Future

Picture by Ed.ward

Greetings everyone! Time to tuple-up! Or is it bucle-up? Who cares... Just make sure to fasten your seatbelt because we are about to begin a journey!

Today, we'll be discussing two very simple yet very powerful types in Python: Lists and Tuples. You may have heard of arrays in other programming languages, but in Python, we have lists and tuples instead, which are in fact, very similar to them.

Let's begging by quickly defining what a list or tuple is. A list is a variable that can store several values, just like it's name suggests. For example, a list of all of your friends' names. A tuple, on the other hand, is a constant that can hold several values, and obviously it remains unchanged throughout the program. For example, a tuple with the months of the year. Let us begin.

#### Lists

Declaring a new list is quite simple. All you have to do is type the name of the list, followed by the values you would like to assign inside of square brackets. Take a look:

`myFriends = ['Daniela', 'Diego', 'Christian', 'Jillian']`
`myLuckyNumbers = [2, 3, 7, 13, 10, 15]`

As you can see above, I declared two lists. The first one, a list that stores strings, and the second one, stores integers. As you may have intuited from the example, you cannot store different data types in the same list.

Each item is stored in an index number of the list, starting from 0. So if I had to chart the second list for example, it would look something like this:

 Index Value Stored 0 2 1 3 2 7 3 13 4 10 5 15

Consequently, if you need to work with a specific value stored in n index, you would simply call Continue reading "TUPLE UP! – Diving deeper into Lists and Tuples"

# Lists & Tuples

--Originally published at Python &amp; pugs

This is a very easy topic and I’ll explain it in a very easy way.

To identify a list and a tuple just look at this example:

A tuple can be write withouth the “[” “]”, and also you can use “(” “)”, so it is the same if you write:
x = 1,2,3,4

or

x = (1,2,3,4)

But for lists you’ll need to write it with “[” “]”

y = [5,6,7,8]

And now, you can use these lists and tuples in several ways, but I’m going to show the easiest way to use them, and we are going to ask for a number in a certain for position, and for this you need to know that python starts counting from 0.

# 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"

# FORever ALONE

--Originally published at Coding The Future

Today, I will share the very sad story of my relationship life: I am, and forever will be a forever alone. But that's ok. To be honest, I don't mind the single life. Love's just complicated for me.

But anyways, you are probably wondering why am I telling you this, which is probably useless. Well it kind of is useless, but today's topic, For Loops, got me thinking.

So, let's dive into today's topic: For Loops. Remember while loops? Well for loops are not so difference. Only difference is that this time, we know exactly how many times the loop needs to run.

Here's an example: Let's say we wanted to ask a user to enter their password, and we need the user to enter it twice. Since we know that the loop will run exactly twice, the most appropriate way to accomplish this is a for loop. Let's take a look at the following program:

`password = ["pass1","pass2"]`
`i=0;`

`for counter in range(0,2):`
`⠀⠀password[counter] = input("Please enter your password: ")`
`⠀⠀i= i+1`

`if (password[0] == password[1]):`
`⠀⠀print("Both passwords match")`
`else:`
`⠀⠀print("Passwords do not match")`

As you can see, the first two lines simply declare a list and an integer. The following lines is where the magic happens. As you can see, I started with the keyword for, and declared a counter variable called counter, followed by the key words in range and the range from which the loop will run. As you can see, this range is in brackets, and it says (0,2). Check the footnote to know why this means it will run twice.1 I end off with a colon.

The code bellow just asks the user for input, stores it in a list, and at the end of the loop Continue reading "FORever ALONE"

# List/Tuples

--Originally published at Programming

## Introduction

Don’t worry. This topic is not going to be as hard and abstract as the last one, today we are going to go back to something simple. We are going to learn about variables! But not like the normal kind of variables… Let’s get started. A variable is a reserved space of memory that stores information, which can be changed at any time. If you want to store a long list of information that doesn’t change over time or a long list of information that changes over time. How can you do it? Well here are the answers to your problems:

### Lists

Just like its name, it contains a list of elements. Each one of the elements is numbered (has an index), starting from zero. You are allowed to remove items and add values to the list by using their position index on the list. Basically lists are one of the most important concepts in Python that you’ll be using a lot. Think of it as a variable on steroids.

### Tuples

Tuples are just like lists, the only difference is that you can’t change their values. The values that you give the tuple the first time are the values the tuple is going to have for the rest of the program’s life. Just like the list, each value is numbered starting from 0. Unlike lists, the tuples must have parentheses surrounding their values instead of brackets.

*Note: The list examples were taken from a YouTube video https://youtu.be/1yUn-ydsgKk?list=PL6gx4Cwl9DGAcbMi1sH6oAMk4JHw91mC_ You should check out his channel.

# 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}`