Importance of reading code.

--Originally published at Hackerman's house

A skill that is really important to develop is read code not just write it. This will give us a lot of knowledge cause we will se how other peopledo the same thing that we do but in a different way. This will allow us to enrich the way we write code.

Also we will be able to read code and understand what is happening.

We have a lot of opportunities to read others people code, like github, where we can access code of some really interesting projects. I encourage you to do this in order to improve your skills as a programmer.

giphy-8

Here is a blog that I found very interesting. http://cosicasdeinformatica.blogspot.mx/2015/02/la-importancia-de-leer-codigo-fuente.html


Strrrings

--Originally published at M E R I N O

A string is type of variable. It accepts any type of characters like numbers, letters or special characters. It’s often used to write words.

To declare a String you only need to write between “”t the text you want to show, after the name of the variable

example = “String”

You can also set something to be a string writing str().  The part of code you want to be a string goes into the parentheses

str(input(“Write something”))

Here is a blog that shows some tricks you can use with strings


Do this… Not like that… Oh… C’mon…

--Originally published at M E R I N O

Ok, let’s go straight to the point. Humans never follow instructions. Why? Because we’re humans and we love doing whatever we want.

The problem is that computers don’t work that way. If a program ask you to write 7, as a number not as letters.

As programmers we can “obligate” the user to write the way we want.

How? With a cool function called try and except

Captura de pantalla 2016-10-28 a la(s) 22.24.58.png

Captura de pantalla 2016-10-28 a la(s) 22.28.00.png

Captura de pantalla 2016-10-28 a la(s) 22.28.41.png

This make the question if “something” isn’t an integer then print “this is not a whole number”, if it is, then print “Good Job!”.

If you want to know more about validating inputs click here


While-dest dreams

--Originally published at M E R I N O

While loops yay.

This loops are used when you want to repeat a section of your code like printing a message if the input is wrong or if you want to interact with a variable until it’s true. like making a count to 10. You can also use else to do something when the loop ends and make it cooler. Here is an example:

Captura de pantalla 2016-10-10 a la(s) 11.58.21.pngCaptura de pantalla 2016-10-10 a la(s) 11.58.45.png

But be careful, because if you write something weird or the wrong operator you can end with an infinite loop. Whoops. Like this example:

Captura de pantalla 2016-10-10 a la(s) 12.06.08.png

Captura de pantalla 2016-10-10 a la(s) 12.08.08.png

Clic here if you want to know more about While loops and here if you want to know if you’re using the right operator. Thanks for reading. CODE!


Fruit-Loops

--Originally published at M E R I N O

101 For Tec

Loops are very used in daily life, and I´m not talking about food, i´m talking about programming. But you may ask what is a loop. A loop according to the Merriam Webster is “a series of instructions (as for a computer) that is repeated until a terminating condition is reached”.

Loops depend of a condition, this is a boolean, a boolean is a value that can be either false or true, for more information of Basic Operators, you can go here

In python we have two types of loops and one conditional:

  1. If else
  2. For
  3. While

Now…what is the structure of a loop? It is the following

loop-statement

And…what about the ‘if/else’ conditional? Is this

conditional

In the following posts Rodrigo Merino and I will explain you more about this

References:

http://www.merriam-webster.com/dictionary/loop

http://www.tutorialspoint.com/computer_programming/computer_programming_loops.htm

https://www.tutorialspoint.com/python3/python_decision_making.htm

View original post


pIFthon

--Originally published at M E R I N O

If statement:

The If statement is a conditional statement and works like this. If a value is true then the instruction stop and the code continues, but if the value is false, the code read the next line on the IF.

loop_architecture.jpg

 

The syntaxis is like this:

if expression:
<body>
else:
<body>

Here is an example:

Captura de pantalla 2016-09-12 a la(s) 10.25.02.png

Captura de pantalla 2016-09-12 a la(s) 10.25.28.png

For more details about IF and ELSE you can go to here and here. And also check this blog for more loops wohoo.


Burgers In-n-Out for free woohoo!

--Originally published at M E R I N O

Disclaimer: There are no free burgers. Sorry.

Input and Output:

L e t ‘ s   G o (Input):

To input text into a program, we use: input(“Text you can see”). You can play with this too, you can specify what type of input you want like int(), float(), etc. you can find the types of variables of python here.

Ruuuuuuun (Output):

To write an Output we use: print(“Text you want to print”)

Here is an example of bothCaptura de pantalla 2016-09-11 a la(s) 23.40.27.pngCaptura de pantalla 2016-09-11 a la(s) 23.40.41.png

For more details, visit this page. Thanks for reading


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!

You’re not my Type sorry

--Originally published at M E R I N O

Variables:

First, we have to know what is a variable?

In programming, a variable is a value that can change, depending on conditions or on information passed to the program

-WhatIs.com

Now, we know what is a variable but… How do I assign it?

To assign a variable you just need to add the equal sign (=) that’s it, you now have a variable… Kinda.

Also you can do multiples assignments like this:

Or assign the same value to different variables like this:

 

Types of variables:

There are 6 main datatypes of variables.

1- Numbers:

In this category are 4 “subcategories”:

  • Integers (int)
  • Long Integers (long)
  • Floating point real values (float)
  • Complex Numbers (complex)

Here are some examples:

captura-de-pantalla-2016-09-11-a-las-20-37-28

captura-de-pantalla-2016-09-11-a-las-20-38-17

2 -String:

In a string variable you can add any type of characters, number, symbols letters, you only need to add “” and write whatever you want, like this.Captura de pantalla 2016-09-11 a la(s) 20.40.43.png

 

3- List:

In this variable you can add various values to a single variable, you declare it with [] and separate the values with a ” , ” like thisCaptura de pantalla 2016-09-11 a la(s) 20.49.27.pngCaptura de pantalla 2016-09-11 a la(s) 20.50.01.png

Then you can choose the value you want or the range of values. For a single value you only write between the [] the number in which the value is positioned, be careful because in Python, the first value is the value 0

Captura de pantalla 2016-09-11 a la(s) 20.50.41.pngCaptura de pantalla 2016-09-11 a la(s) 20.51.09.png

Captura de pantalla 2016-09-11 a la(s) 21.03.25.pngCaptura de pantalla 2016-09-11 a la(s) 21.03.42.png

To remove an element from the list, you can use del list [#]  or you can use list.remove (“value”). It only takes out the value but the sequence keeps going with the next value . Here is an example:

Captura de pantalla 2016-09-11 a la(s) 21.07.45.png
Captura de pantalla 2016-09-11 a la(s) 21.08.02.png

Also you can change or update the values of a list, like this:
Captura de pantalla 2016-09-11 a la(s) 22.16.10.png

Captura de pantalla 2016-09-11 a la(s) 22.16.35.png

4 – Tuple:

A Tuple is like a list, but less flexible and instead of using [] we use (). You can’t replace values. Example:Captura de pantalla 2016-09-11 a la(s) 22.04.52.png

Captura de pantalla 2016-09-11 a la(s) 22.05.33.png5-

Captura de pantalla 2016-09-11 a la(s) 22.11.10.png
Captura de pantalla 2016-09-11 a la(s) 22.11.23.png
Captura de pantalla 2016-09-11 a la(s) 22.21.35.png
Captura de pantalla 2016-09-11 a la(s) 22.21.56.png
Continue reading "You’re not my Type sorry"