The end of the beginning

Hey, what’s up?, well I want to talk about something different this post, today was the last day of clases of my second semester at the Tec. After studying and making some programs (and blog post) in order to get prepared for my final exams, I remembered all the things I have gone through the last year, I have stressed, frustrated and sometimes suffer but also I have made friends, have fun and above that I feel more capable than the last year. All the year has been full of new experiences that I’m glad to have had.

To end this I just want to thank you for have read my blog and somehow have been there for me 🙂

what does the «e» means?

The e is a math constant which value is aprox 2.718

the number is calculated whit this definition

Captura de pantalla 2017-05-03 a las 11.28.33 p.m.

to know more about the number read a little in wikipedia: https://es.wikipedia.org/wiki/N%C3%BAmero_e

Captura de pantalla 2017-05-03 a las 11.26.15 p.m..png

the program ask for the precision you want in the calculus and returns the number obtained

Captura de pantalla 2017-05-03 a las 11.26.07 p.m..png

🙂

want a banana?

Hey, this post has a peculiar program it receives a single parameter called filename (a string) and returns a positive integer which is the number of times the word bananas is found in the file, the word can be any case

Captura de pantalla 2017-05-03 a las 10.15.54 p.m..png

the program converts each character to lower case then replace each bananas for i, finally it counts the number of i whit an if

Captura de pantalla 2017-05-03 a las 10.15.45 p.m..png

trying whit two «sentences»

so it works 🙂

Babylonian programer

Hey, this post program is used to calculate the square root of a number thru the Babylonian method, which is:

Captura de pantalla 2017-05-03 a las 8.46.18 p.m..png

just in case you don’t understand check this website about the topic: http://tedmuller.us/Math/SpecialContinuedFraction.htm

Captura de pantalla 2017-05-03 a las 9.54.00 p.m.

lets try it whit 169

Captura de pantalla 2017-05-03 a las 9.54.22 p.m..png

and it works 🙂

 

something different :) (Data and files)

The program this time will receive a string parameter which is a text data, then the function of the program will count the number of characters and lines in the file

Captura de pantalla 2017-05-03 a las 8.24.23 p.m.

just to remark, in the line number 3, the program Initializate two different variables to save space, so as other little things like that, how many of them can you find?, leave a comment 😉

Captura de pantalla 2017-05-03 a las 8.35.43 p.m.

that is the text, so lets try the program

Captura de pantalla 2017-05-03 a las 8.27.09 p.m..png

and thats it see you next blog

 

 

«Fun» whit Lychrel numbers

Hello this post it’s a little special because this program was a little more difficult that what I expected but here it is:

Captura de pantalla 2017-05-03 a las 6.23.02 p.m..png

The difficult of the program consist in two things:

  1. Constantly converting the data from int to integer and viceversa
  2. The risk of get a bad syntax error

Captura de pantalla 2017-05-03 a las 6.17.52 p.m.

Feel free to leave a comment if you have a specific question  😉

let’s play whit a list

Hello, long time no see, this time we will create a program whit a function that receives a list of numbers, and it calculates the sum of the numbers, the averages and the standard deviation of the numbers in the list.

if you dont know whats the standard deviation check the wikipedia page: https://es.wikipedia.org/wiki/Desviaci%C3%B3n_t%C3%ADpica

Captura de pantalla 2017-04-17 a las 11.03.03 a.m.

The program adds the numbers whit a while cycle. The number is added in the line number 16 whit the append

The function just do some math operations, and the results are separated in the line 18.

trying the program:

Captura de pantalla 2017-04-17 a las 10.49.26 a.m.

and that’s it, if you got a question leave a comment and i’ll try to answer 🙂

Factorial calculator

In this post we will learn what is a factorial number and make a program for calculate this. A factorial number is the product of all the previous numbers, an example is:

factorial of 3= 1x2x3=6

so a posible option to calculate this thru a program is whit a whileCaptura de pantalla 2017-03-29 a las 10.27.47 a.m.

and as you can see it workssss!

Captura de pantalla 2017-03-29 a las 10.27.34 a.m.

another program to use conditionals its a good practice, see you on the next post

 

On the functions

On this post we will check one of the first things I published, fun whit numbers if you want to check it again do it here: https://etomanue.wordpress.com/2017/02/02/fun-whit-numbers/, the difference whit that post is that now its going to be done whit functions.

As a reminder the program ask for two numbers and returns:

  • The sum of the two numbers.
  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

Captura de pantalla 2017-03-16 a las 10.56.38 a.m.

As you can see the math is done on the functions and the results are printed later on the last lines of the program (19, 20, 21).

Captura de pantalla 2017-03-16 a las 10.55.57 a.m.

and thats it. This is basically an exercise to practice how to do functions. Thanks for read my blog again 😃 😄.

 

 

Simple python exercises #1

On this post we are going to do some exercises of programming there are a total of 46 but for this post we will just do 5 of them.captura-de-pantalla-2017-02-23-a-las-10-29-51-a-m

for the first one:

captura-de-pantalla-2017-02-23-a-las-10-28-39-a-m

captura-de-pantalla-2017-02-23-a-las-10-28-28-a-m

For the second one:

captura-de-pantalla-2017-02-27-a-las-11-07-02-a-m

captura-de-pantalla-2017-02-27-a-las-11-07-44-a-m

The third one:

captura-de-pantalla-2017-02-27-a-las-11-10-30-a-m

captura-de-pantalla-2017-02-27-a-las-11-09-59-a-m

A for is something to which the program would do something in this cae count each character of the string whit the counter «count»

The forth one:

captura-de-pantalla-2017-03-01-a-las-12-54-35-p-m

captura-de-pantalla-2017-03-01-a-las-12-55-30-p-m

And the last one (for this post):

captura-de-pantalla-2017-03-01-a-las-1-07-32-p-m

captura-de-pantalla-2017-03-01-a-las-1-07-20-p-m

If you have a question comment and I will try to answer it, also if you want to see the full list of the exercises : http://www.ling.gu.se/~lager/python_exercises.html

Thanks for read my blog again 🙂