Author Archives: Efrain Duarte

Mastery 12 Creating Python Functions

In this mastery I am going to explain how to create function in python. First  the sintax of  the function is “def”, it has to start always with that, after is the name of the function(is what ever you want it),next to the name is going to be the argument and put the tho dots at the end.In the following lines you have to define what is going to do your function, it depends of what do you want. To finish the statement return is going to be the output of the function (what is going to print the function).

also here is a link where you will found more information : http://librosweb.es/libro/python/capitulo_4/definiendo_funciones.html

 

Calling python function

In this mastery I would explain how to call function in python, which is very easy. First you have to create a function with an argument, after the function is ready, you have to ask to the user for a variable , and after that you going to write the name of the function but now with a parameter. for example in this following picture which is here in this link: https://www.dropbox.com/s/7pbpv604d78563g/Captura%20de%20pantalla%202015-03-16%2015.34.52.png?dl=0

here we have five diferent function, that their arguments are “a” and “b”, but whe we want to call that function, we write the name of the function and write the parameter that are “x” and “y”. As easy as that.

Basic Types in Python and their use

 

there are different types of way that we can store data. In python the  most basic data are numbers and strings.

*First in the numbers we have the integers numbers and float numbers.

-Integers numbers are conformed for all the numbers that are in the range of negative infinity to infinity, e.g., -1, 0, 1, etc.

-Float numbers are  all the numbers that has digits afters their decimal point. For example: 3.3,4.66,5.9, etc.

*Second the strings can be numbers,letters and any others characters, but all of this characters has a simple sintax, if you want to write strings in a code, you has two option:

1)with double quotes example -> x=”hola mundo”

2)with only one quote example -> x= ‘hola mundo’

Python Conventions

Python conventions are 20 aphorisims.

Python conventions, called “The Zen of Python”. Also if you want to know what are they, you jus have to create in a editor a code that jus say “import this” and run it in the terminal.

here is a picture about how is it: https://www.dropbox.com/s/eiv02sfo3fybxk3/Captura%20de%20pantalla%202015-03-16%2011.34.49.png?dl=0

 

Install Linux on my own computer

In this mastery I had to install linux in my own computer which has windows 8, so I was searching in internet what I can do for has both in one computer with any problem, well with internet and a little help of a friend I found very helpful a program call “Virtual box” that allow me to have other operator systems in on computer with any changes or problemas.Also linux is free and yo can found it here: http://www.ubuntu.com/download .

In this link you can see linux in my own computer: https://www.dropbox.com/s/1zbpag1h5i7i6a4/Captura%20de%20pantalla%202015-03-16%2011.20.20.png?dl=0

in the picture you can watch that I also have Windos 7 and linux in virtual box. so I had hope help you.

Submit work via Blog RSS and Github

well in this mastery I will explain you  submuit works via blog and github.

well first about submit works via blog, you have options of blogs , but I am using withknown, and let me tell you that is nice and easy to use. Also the support that the operators bring you is very helpful and quickly to solve any problem that you have. Ok lets see, after that you create a blog in withknown you have to sig in, the next move is to go where it say “All content”, here will show you 8 option, click in where it say posts, here you can posts what ever you want.

lets go to git hub, git is more nice in the way that in you profile has a lot of things, but for you submit works via github, you have to download the programm github, which is free in the page. After that you have to create a repository where is going to be all the works that you want to submit. Next in your computer you have to create a folder, and inside the foldre will be the works to, so you get in to the programm and synchronize the repositori and thats it. you can go to profile in the web page, go to the repository and you works will be there.

here is a video where my teacher explain better how to do it:  https://www.youtube.com/watch?v=YQmlksGFZWY&feature=youtu.be

Yo soy 196

In this wsq I create a program that ask por the user for a lower bound and the upper bound, so the program will print the number of natural palindromes, non-lychrel numbers and lychrel candidates contained in the range pf that numbers.

I also create a function to see if the numbers are palindromo natural number.

At the end the program will print which numbers are lychrel numbers, of course that in this programa just can see the categories fo that number in 30 iteration at maximun.

so here is my code: https://github.com/EfrainDuarte95/TC1014/blob/master/wsq11.py

this will help: http://docs.python.org.ar/tutorial/3/datastructures.html

wsq10 Lits

 

In this wsq I had to create a program that first ask for 10 float numbers, and I created a list with that numbers, so the program will calculete the sum,average and standar desviation of that numbers.

After that I had to chage a little bit, besause now, the program will ask to the users if he want to add an other number or not, other thing that a use was the while True, because if the users write a string it will made an error, but with this while, the program will tell to the users that the strings is not a float number and he has to write a number.

here is the first one: https://github.com/EfrainDuarte95/TC1014/blob/master/wsq10.py

and here is the second:https://github.com/EfrainDuarte95/TC1014/blob/master/wsq10.1.py

Factorial WSQ09

For this wsq I had to calculate the factorial of one number wich is non negative and integer. This thing is easy importing a function, but I made this program with out that, using the loop while, and some other things like try and  except statements.

this is the link of my program: https://github.com/EfrainDuarte95/TC1014/blob/master/wsq09.py

 

 

WSQ08. On to Functions

 

In this wsq08 I did the same thin that I already did en wsq03, just with some diferents thing, such like now I had to define a function and call the function.

so here is my code: https://www.dropbox.com/s/wrrn10b0m7ueycl/wsq08.py?dl=0