While vs For in Python

--Originally published at Ed_Alita

The backgroud

This two funtions are used to create loop that inside is a code that you wish to repeat it self. The question is if they are the same how to choose between them. I will explain each one and then teach you how to choose between them.

For

This funtion repeats itself only the times that you indicate or until it condition is not longer true.

Lets see this example:

for1

This code for each letter in the word Python will run the code.

Let’s see what it does.

forex1

While

This funtion repeats itself until it make false it’s value.

This is the logic that While follows:

while1

The next Example will make it clear:

while2

This program will run each time until count be 9. Lets see what it does:

whileex1

Which one I use?

The use of each one depends on what you need. Lets see if you know how many times the user will put the correct answer use for but if you don’t know how many times you can use a infinite while.

The material use can be seen here:

https://docs.python.org/3/reference/compound_stmts.html#while

 


Nesting Condicionals in Python

--Originally published at Ed_Alita

Did you mean this?

No!!!

Nesting is puting a lot of conditional in order to make a more complex decison. For example the joysticks of a Xbox 360 have this kind of thinking.
Lets see a example of a code to see it clear:
nested1
The nested of this conditional take the input and comparte it with a range of cases.
This kind of of coding make us a easy liofe because it make the code to has flow and make it simple to see it.
The Result of this code is the next one:
nestedex1

If, else and elif Python

--Originally published at Ed_Alita

The core of a program is if and else because thaey give the flow to a program therefore in order to make a program you net to know how do if and else work.

 

ifex3

 

 

@SummerBreak chill flow summerbreak summer break

 

 

 

 

To put in python this is the rules to put it:

if

It has three parts the comparator and then the action this is a if context.

To do a else if comparation is the next one.

if2

The last part is the else if the compartor does not apply it goes directly to the else.

If the condition is true:

ifex1

if the cpondition is false:

Now you are a step futher in becoming a code master.

Elif

This operator is use to compare a variable to a lot of expressin if any of them is true you go to a default expression.

Put the next cod eto invoque the elif:

elif

the result is the next one:

elifex

 

The material seen here is in:

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

 

 


Coderoulette a new for to code

--Originally published at Ed_Alita

This service was created by the slogan of “The most bigs challenges of humanity has in front can not be solve by individues instead it will be solve by colaborating”. The two creators of this new tool are Ariel Camus and Miriam Muros. The sofware allows that two unkwon developers colaborate to solve a challenge in any language of code. This tool is similar as Chatroulute but for developers.

Know I will show you how to use this sofware.

1 – Enter to the next link:

You should see this screen.

blog

2 – The next thing is to enter with your github account.

blog1

3 – Then Authorize the applicationblog2

4 – Then select your level of skill

blog3

5 – Select the languges of programing that you know

blog4

6 – Select the languge that you want

blog5

7 – Know solve your first challenge.blog6

Conclusion

After using this sofware after 2 hours I can say that it is a great tool for challenging you in the language that you want to learn.

 

 


El presente y el futuro de la Tecnologia

--Originally published at Ed_Alita

En esta investigación se debatirá sobre cuál será el futuro de la electrónica, dentro de la misma se dividirá en tres partes las cuales se tomarán el tema desde tres perspectivas la primera se analizará dónde se encuentra la electrónica, la siguiente cual es el futuro tangible y por último se expondrá el futuro imposible. La razón de por qué estudiar lo imposible es porque “lo imposible es relativo y nos abre la posibilidad de entender cuáles limites podemos romper” así lo escribe el Dr. Michio Kaku en su libro: Física de lo imposible (2013).

Lo primero antes de entender dónde nos encontramos, tenemos que definir lo que es electrónica. La RAE (2014) define a la electrónica como el estudio del comportamiento de electrones en diversos medios. En la conferencia de Consumer Technology Association (CES) un magno evento donde se presentan las tecnologías más novedosas actuales. En este evento se define cuáles son las tendencias electrónicas de las cuales se destacan coches, electrónicos, realidad virtual, drones y pantallas plegables. (Berengueras, 2016) La siguiente vertiente es la microelectrónica la cual nos ha permitido la creación de tecnologías muy pequeña esto permitiendo muchas innovaciones tecnológicas. (Cortés, 1998)

En el futuro tangible la electrónica se volverá más compleja y se intentara llevarla a la microelectrónica esto es debido a que las nuevas tecnologías se buscan que sean portables y pequeñas. Dentro de estas nuevas tecnologías se presentan el llamado papel electrónico los cuales son pantallas delgadas como una hoja y que se pueden conectar entre ellas. En la otra mano la búsqueda de interfaces generadas por proyección se busca que sean una realidad esto debido a que no se necesitará de ningún dispositivo para generar un input, más que tus manos. (Sagrado, 2015)

El siguiente futuro está ligado a este futuro la realidad

Continue reading "El presente y el futuro de la Tecnologia"

Creating your own Modules in Phyton

--Originally published at Ed_Alita

Creating a Module

This is the 2nd part of my last post. In a new document of phyton we are goig to create a module or librarie. Therefore the first thing to do is to define a funtion and what does the funtion have to do.

The next exmaple is on how to get the fibonnacci serie.

This is a very simple example:

fibo

In this second case is the same only it put the result in a list:

Then we save it as Fibo.py

Using it

Now we go to cywin or your compiler.

  1. We got to the location of our programs.
  2. Next we put python3 and presss enter.
  3. Then we import the Fibo archive.fiboex1
  4. Then we put Fibo.fib(10) With this we are calling a funtion that is inside of  Fibo.

fiboex2fiboex3

The information mentionted in this archive is in the next link

https://docs.python.org/2/tutorial/modules.html

 


Import and Used Libraries in Python

--Originally published at Ed_Alita

In Python there are all lot of functions that are not in it. In this cases they are called libraries which can be imported. There is a list on  which libraries are default in python3 here. Let’s how they work:

This how to import a libraries:

Screenshot from 2016-08-25 11-01-40

This code is how to run a simple random:

Screenshot from 2016-08-25 11-01-57

The Result of the code is the next one:

Screenshot from 2016-08-25 11-03-28

The resources of this information is the next one:

http://www.pythonforbeginners.com/random/how-to-use-the-random-module-in-python

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

 


Functions in Python

--Originally published at Ed_Alita

what huh cece hannah simone new girl

The elemental thing to understand this topic is to define what a function is. It can be define as a block organized, reusable code that is used to perform a single, related action. The language of python by default is gave you a lot of functions but you can make your own functions.  Let’s see how we can do it:

1 Step

Define a function

In python you can define function to be use in you code. The  rules to make these are the followings:Geek & Sundry stranger things law rules rule

  • The functions begin with def followed by the function name and parentheses ().
  • Any input parameters or arguments should be placed within these parentheses.
  • The first statement of a function can be an optional statement.
  • The code block within every function starts with colon (:) and is indented.
  • The statement return exits a function, optionally  passing back an expression to the caller. A return statement with no argument is the same as return none

Syntax

def function-name( parameters ):
   "function_doc string"
   function_suite
   return [expression

Example

The following function take the parameter string and then print it

Screenshot from 2016-08-22 19-50-02

2 Step

Calling a Functionexcited great awesome oprah exciting

Defining a function only gave it’s name an the parameters of it. So how the hell I use this thing that I create.

To call a function is simple you only put the name and the parameters let’s see with printme().

Screenshot from 2016-08-22 19-50-21

The result of calling by this way is the next one.

Screenshot from 2016-08-22 19-51-57

Function with multiple arguments

This example is only to show you that you can have more than one argument inside a function.

Screenshot from 2016-08-22 19-50-43

This function requires two arguments therefore is more complex. The age can be initialized by any value in this case I use 35 only for the lols.

The result of calling it and running it is the

Screenshot from 2016-08-22 19-51-19
Screenshot from 2016-08-22 19-52-17
Continue reading "Functions in Python"

Basic data Types

--Originally published at Ed_Alita

The informatic language as in real life they have like languages but in Python they are call Variable Types. This types are determine by the value stored within the variable. In other languages you need to put the type before the variable as example “boolean” but in Python supports type inferencing. The most general compatible variable type choosen.

They are three main categories of variable types in Python.

Primitive Variables

technology promotion primitive

Primitive variables are the most basic, hence their “primitive” title. They are caple of storing a single variable. There is list of primitive variable below.

Integers

Numbers such as 23 or -44

Floats

Very little numbers such as 4.3356

Strings

Phrases such as “Python” (Note all letters need to be enclosed by ” ” )

Characters

One letter such as “A” or “#”

Complex Variables

amor alone lonely hard leaving

Tuples

A list of Fixed number of elements. Ex. x=(1,2,3)

Lists

A list without a fixed number of elements. Ex. x=[1,2,3]

Dictionaries

A type with multiple elements where you address the elements with a text.

Ex. x={1:’a’,2:’b’,3:’c’}

Use of Them

Integers

This is how to code with Integers.

integers

The result of this is the next one:

integersEx

Note that you can do Arithmetic with integers.

Strings

string

The result of this is the next one:

stringsEx

Tuples

Turples

This create a tuple with three elements. Also you can print them with this code.

turples1

The result of this is this:

turplesEx1

Also you can print a specific element of the turples. With the next code:

Turples2

The result of this code is the next one:

turplesEx2

The question that you may have is why is priting the second element if I put that the 1 element is needed to be print it. The reason of this is that python start numering by the cero therefore element1 = 0, element2 = 1 and 

turples3
turplesEx3
List1
ListEx1
list2
listEx2
Dictionaries1
DictionariesEx1
Dictionaries2
DictionariesEx2
potato dancing potato
Continue reading "Basic data Types"

Use of comments in Python

--Originally published at Ed_Alita

The reason to put comments in a Phyton program is in oder to know what does a funtion does. For example let’s say that you pass your code to a friend whitout any comment so he only stare at the code. He probrably can deduce what a funtion does but he doesn’t know all what you are doing in the code.

Know that I explain why comments are so important lets talk about how this comments work. In Python there are two types of comments the first ones are called the single line comment. This comment works by this way, you need first to put “#” and after it put your comment. (Remember to close it by putting “#” at the last of your comment. The comments don’t interrumpt the flow of the program.

This is the example of this:

Phyton3

The other comments are mutiline string those ones can take planes in many lines those ones are useful when you need to describe more than a funtion.

This is the example of this:

python4

#TC101 #Python

The material use in this blog  can be read at http://www.pythonforbeginners.com/comments/comments-in-python