Are you the kind of guy that distracts with he´s own music while doing homework? here you have a list of no pause soundtracks free from letters and not sticky but relaxing and helpful for concentration music
Month: octubre 2016
Videos for relaxing
Most of the time, we manage very high stress levels, and we need to relax, here I show you some helps
Watch series
b
Series help you to relax and concentrate in other things
Watch something new, not just the classy
This really helps a lot, because you make yourself more open and know more about other cultures, I, for example, am starting to see korean doramas
Surf in the Web
God, web is a really big ocean that is recomendable for you in stress moments, and it has from everything, not just procrastinating stuff also you can go into sites like Lynda or Coursera and learn new stuff
What´s list?
Today I´m talking about lists, as I mention in a previous post, a list is a group of items that have a position. The syntax of the lists is like it follows:
name_of_the_list = [elements,elements]
The positions start at 0 and you call them like this
name_of_the_list [0]
Also you can modify them just calling the position and making it equal to the new value
list1[0]: physics
or delete elements writing del before the position
del list1[2];
Also you´re able to do the basic operations
Python Expression | Results | Description |
---|---|---|
len([1, 2, 3]) | 3 | Length |
[1, 2, 3] + [4, 5, 6] | [1, 2, 3, 4, 5, 6] | Concatenation |
[‘Hi!’] * 4 | [‘Hi!’, ‘Hi!’, ‘Hi!’, ‘Hi!’] | Repetition |
3 in [1, 2, 3] | True | Membership |
for x in [1, 2, 3]: print x, | 1 2 3 | Iteration |
or for more fun stuff check this:
I know that you know that I love you
Have you ever heard something like this? Well, in natural language is something common, and oh surprise, in programming also is. In programming we have something that is called recursive functions.
«Recursion is a method of programming or coding a problem, in which a function calls itself one or more times in its body. Usually, it is returning the return value of this function call. If a function definition satisfies the condition of recursion, we call this function a recursive function.
A recursive function has to fulfill an important condition to be used in a program: it has to terminate. A recursive function terminates, if with every recursive call the solution of the problem is downsized and moves towards a base case. A base case is a case, where the problem can be solved without further recursion. A recursion can end up in an infinite loop, if the base case is not met in the calls.»
Here is one example
This code throws the six first lines of the Pascal´s triangle:
References:
So…you´re into this?
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:
also with while’s
with if else, and also combining them.
Here is one example of what you can do with nested loops:
References:
https://www.tutorialspoint.com/python3/python_nested_loops.htm
While
While
The flowchart of a while is this
This is the structure of a while
One example of while
References:
For
For
The flowchart of a for is like it follows:
This is the basic structure:
val is a certain value or ‘conditional’
Here is one example
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:
Fruit Loops the revenge
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
this is how it works
and here is one example
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:
This is the basic structure:
val is a certain value or ‘conditional’
Here is one example
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: