So…you´re into this?

--Originally published at 101 For Tec

Nested loops ¿what are they? A nested loop is a loop within a loop, an inner loop within the body of an outer one. Is possible to realize this with all the different types of loops, with for´s, here is the basic structure:
nested_for_syntax

also with while’s

nested_while_syntax

with if else, and also combining them.

Here is one example of what you can do with nested loops:

nested.PNG

References:

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

http://tldp.org/LDP/abs/html/nestedloops.html


For

--Originally published at 101 For Tec

For

The flowchart of a for is like it follows:

for_1.PNG

This is the basic structure:

for_0.PNG

val is a certain value or ‘conditional’

Here is one example

for_2.PNG

for_3.PNG

Important information about for´s:

  • The for statement in Python has the ability to iterate over the items of any sequence, such as a list or a string.
  • If a sequence contains an expression list, it is evaluated first. Then, the first item in the sequence is assigned to the iterating variable iterating_var. Next, the statements block is executed. Each item in the list is assigned to iterating_var, and the statement(s) block is executed until the entire sequence is exhausted.

References:

http://www.programiz.com/python-programming

http://www.tutorialspoint.com/python3/


Fruit Loops the revenge

--Originally published at 101 For Tec

In this post I´ll explain the missing loops, those are: elif, while and for. So  let´s get started.

Elif

This is the flowchart of an elif

elif.jpg

this is how it works

elif.PNG

and here is one example

elif_1.jpg

Important information about elif:

  • The elif is short for else if.It allows us to check for multiple expressions.
  • If the condition for if is False, it checks the condition of the next elif block and so on.
  • If all the conditions are False, body of else is executed.
  • Only one block among the several if…elif…else blocks is executed according to the condition.
  • The if block can have only one else block. But it can have multiple elif blocks.

For

The flowchart of a for is like it follows:

for_1.PNG

This is the basic structure:

for_0.PNG

val is a certain value or ‘conditional’

Here is one example

for_2.PNG

for_3.PNG

Important information about for´s:

  • The for statement in Python has the ability to iterate over the items of any sequence, such as a list or a string.
  • If a sequence contains an expression list, it is evaluated first. Then, the first item in the sequence is assigned to the iterating variable iterating_var. Next, the statements block is executed. Each item in the list is assigned to iterating_var, and the statement(s) block is executed until the entire sequence is exhausted.

While

The flowchart of a while is this

while_0

This is the structure of a while

while_1

One example of while

while_2while_3

References:

http://www.programiz.com/python-programming

http://www.tutorialspoint.com/python3/


Random Stuff for tec

--Originally published at 101 For Tec

Have you ever tried to bake in the microwave? Not? It is very very simple and is something you should try for two reasons:

  1. Cheap. The ingredients you´ll spend are lees, therefore less expensive, also you don´t need to spend money in special baking recipients, what you need is a proof microwave mug.
  2. Quickly. The cakes that you´ll spend an hour doing, you make them in 5 minutes

That´s it, prove it. Here I leave some examples of the recipes you can make with this method

  • This is the complete videos list of videos

This is the videos it contains:

mug_0mug_1

For mor inf check out:

Home


pIFthon

--Originally published at 101 For Tec

Check out the post I worked out with Merino

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.pngCaptura 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.

Ver la entrada original


Fruit-Loops

--Originally published at 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


Wooo, this is more cool than Gandi Libraries

--Originally published at 101 For Tec

This is one of my shortest posts since this is more of self discover.

Libraries are a very useful topic, they are dictionaries that are already made and that you just invoke them, yep…invoke, you just say ‘import library_name’ and ready, you use it as normal.

Here is the link to all the libraries that python has:

https://docs.python.org/3/library/

 


This doesn´t function :(

--Originally published at 101 For Tec

Functions

Syntax

The concept of a function is one of the most important ones in mathematics. A common usage of functions in computer languages is to implement mathematical functions. Such a function is computing one or more results, which are entirely determined by the parameters passed to it.

In the most general sense, a function is a structuring element in programming languages to group a set of statements so they can be utilized more than once in a program. The only way to accomplish this without functions would be to reuse code by copying it and adapt it to its different context. Using functions usually enhances the comprehensibility and quality of the program. It also lowers the cost for development and maintenance of the software.

Functions are known under various names in programming languages, e.g. as subroutines, routines, procedures, methods, or subprograms.

A function in Python is defined by a def statement. The general syntax looks like this:

def function-name(Parameter list):
    statements, i.e. the function body

The parameter list consists of none or more parameters. Parameters are called arguments, if the function is called. The function body consists of indented statements. The function body gets executed every time the function is called.
Parameter can be mandatory or optional. The optional parameters (zero or more) must follow the mandatory parameters.

Function bodies can contain one or more return statement. They can be situated anywhere in the function body. A return statement ends the execution of the function call and “returns” the result, i.e. the value of the expression following the return keyword, to the caller. If the return statement is without an expression, the special value None is returned. If there is no return statement in the function code, the function ends, when the control flow reaches the

arrow
arrow
arrow
arrow
Continue reading "This doesn´t function :("

*Insert your username*

--Originally published at 101 For Tec

How can I make inputs? Its Easy peasy dude.

Inputs themselves are a function and you only need to put ‘input()’ and the program will stop in this line and don´t continue without receiving a string input, this is text.

Here is an example:

input

Here is what happend

ans

 

 

References:

http://www.python-course.eu/python3_input.php