Input and Output

--Originally published at Programming

When you want to introduce data to a programm computer we use an input. Then, this information is processed and you can show the result. This last thing is called output.

A simple example of input is what you type in your keyboard and an example of output is anything you view on your computer monitor.

giphy

Gif from: http://giphy.com/gifs/program-XFEUdfHkPtUxq

 

Now, in python we have something called variables. They are reserved memory locations to store values. We have different kinds of them:

  • Numbers: Data is stored like a numer value.
    • integer: whole numbers
    • float: real numbers with a decimal point
  • String: A series of characters
  • Lists: Values stored, it contains separated items.
  • Tuples: They are like a list, but they cannot be updated.
  • Dictionary: Is like a collection of data type.

You can learn more about it in the following link: https://www.tutorialspoint.com/python/python_variable_types.htm

 

To end this blog, let’s do an example. The user will enter an input and then we are going to show an output.

captura-de-pantalla-2017-01-21-a-las-20-08-04

captura-de-pantalla-2017-01-21-a-las-20-09-18

If you need more help, I could recommend you this video, from Carl Turland: Coding at School: Functions and Variables

 


Basic types (Python3)

--Originally published at Elu's Blog

And we are not talking about snake variants, we are talking about variable types. Variables are just spaces in the memory which we give assign its value and most of the times we can change the value.

In Python3 there are 5 basic types of variables, which are: number, string, list, tuple, and dictionary.

Number: this is almost self explanatory, you can only store numbers in this kind of variable.

String: this variable stores multiple characters in order, like words.

List: this variable let’s you store multiple variables that can be of different data type. So in theory you can create lists of lists.

Tuple: this is like a list but with two key differences. The first one is that lists are enclosed in brackets “[]” and tuples are enclosed in parentheses “()”. The second and most important is that lists can be updated and tuples can’t. This means that after you store values in a tuple, you cannot change those values, only watch them.

Dictionary: this variable is unique. In a dictionary you can store a lot of values but every value needs like a key word for the program to identify. It is like a real life dictionary book, where there are a lot of words and each one of them stores more information.

Alternative Explanations

If you didn’t like my explanation on the topic or you would like another way of seeing this, you can simply check one of these two links:

Tutorials Point definitions and way of explaining

https://www.tutorialspoint.com/python/python_variable_types.htm

Carl Turland’s excellent video about it