jueves, 26 de marzo de 2015

#Mastery04 Work

This is just a little tutorial on how to deliver work to this course via blog.

1. create your course blog:
     you can use any kind of blog that uses RSS technology (Blogger, Tumblr, WordPress, etc..)
2.Link blog to your acount:
   Follow the steps in Ken's page.
3. For every assigment make a new blog post:
     include evidence of the resources you needed and that you did the work.
4. Tag acordingly:
     use a hastag(#) or your blogs tag sistem in your post to be tracked down, use the name of the                asigment (wsq or mastery) plus the two digit number (like in this case #Mastery04).
5. Include a link to the code in GitHub:
     In this Video our teacher explains how to use GitHub. Always allow people to see your code.
6. Study.
7. Have fun.

#Mastery10 basic output

An outout is a the iformation  that goes from the cumputer to the outside world, according to Wikipedia.

the most basic of examples is the Hello world program. every programer makes one.

For this we use the print fuction, witch displays text (of any type) in the screen.

see code for hellow world here.

#Mastery18 nesting of conditonal statements:

in other words putting an if inside an if.
you can see in this program how it creates a hole new conditional statement if the first conditon is not met (an if inside an else).

see here:
def gcd(x,y):
if (x==y):
ans=x
else:
if(x>y):
ans=gcd((x-y),y)
else:
ans=gcd(x,(y-x))
return ans

If the first condicional is not met (the values are not the same) then ,by definition, thay are different, but they can be differnt in 2 ways (greater than and lesser than...), so a new condition has to be made. 

Its really easy, and probably you would be doing it without noticing, the import thing is that all conditionals result on something, and make shure to close them all and dont loose track. 

sábado, 21 de marzo de 2015

#WSQ12

click here for code

this program uses recursion to use a function inside itself (woah! functionception) witch isnt the first time we do that in this blog.

this program finds the Greatest Common Divisor of a pair of int. numbers.


miércoles, 18 de marzo de 2015

#WSQ11

Click here to see code

This program seen here uses fuctions in a fun way to determine weather a number is a palindrome or not.

in this program the number will count as a palindrome if it can become a palindrome, example:

11 = palindrome 

31= (31+13=44) =palindrome

28=(28+82=110)=(110+011=121)=palindrome

The only way that a number will be considered a non palindrome by this program is if it takes +30 steps to turn into a palindrome.

miércoles, 11 de marzo de 2015

#WSQ10

This program is all about lists. Click here to see the code

It has some fuctions made by me and a couple of while loops to make things easy.

I used the python documentation to help me do it. check python documentation on lists.