WSQ14 Scilab

“Scilab is an open source, cross-platform numerical computational package and a high-level, numerically oriented programming language. It can be used for signal processing, statistical analysis, image enhancement, fluid dynamicssimulations, numerical optimization, and modeling, simulation of explicit and implicit dynamical systems and (if the corresponding toolbox is installed) symbolic manipulations.”

Source: Yep, I used Wikipedia. I wasn’t in the mood of doing a long research to define Scilab.

Ok. Let’s start with the blog post.

Scilab is a really useful tool that will help me from NOW to make my math calculations. Besides I’m not quite good at math, It’s funny to use a math software with the programming knowledge that we already have.

Next Saturday is my math Final Exam. I’m definitely using this to check my exercises while I study.


Tanks Ken to give us alternative tools and tips to survive our life in college, not just in your subject, but all the others.



Quiz 7

Hey there! Let’s do the quiz #7.

Quiz 7 is about this:

“Create a function called dot_product that receives two lists of numbers (say list1 and
list2). The function returns what is the dot product of the two lists.

For full marks, if the lists are not the same size, then the function should return the
special value of NaN (which represents not a number). For Python, you can create this value with the expression: float(‘NaN’)”

Let me explain what is the dot product:

“In mathematics, the dot product, or scalar product (or sometimes inner product in the
context of Euclidean space), is an algebraic operation that takes two equal-length
sequences of numbers (usually coordinate vectors) and returns a single number.

Algebraically, it is the sum of the products of the corresponding entries of the two
sequences of numbers” Source:


Heeere’s my code. I’ll explain it step by step.

First of all we define our function “dot_product” that will determine if the lists that my user gave me are the same length or not.

If not, the program will return the NaN result. This will tell the user that he/she is doing something wrong.

Otherwise, the code will do the dot product.

Here’s the link to my code. Enjoy coding!!!! Byeeee!

WSQ13 Exam 2

Good morning! This blog post will explain the exercise that we did for Exam 2.

Exercise number 1

Is about get the distance between two points. The code is the following one:


O line 1 we import the “sqrt” function form the “math” library, we’ll need it because the main formula to get the distance is .

From line 2 to line 5, we ask the user for the four values to get the location of the points. Two values for “x” and two values for “y”.

Then, let’s convert them all to floats so we can manipulate them later.

The magic comes out in line 11, where we ‘translate’ the algebraic formula to a code. As you can notice, we use the ‘sqrt’ function on line 13, and finally, let’s print the result.

Exercise number 2


Can you see the red chart? Yep, don’t do that. It was my failing code at the test.



Quiz 6

Heeey there!!!!! Here’s my 6th quiz. Yup. I know It’s pretty late for it. I will reflect that on my rubric.

Aaaanyway, the fact is that the instructions were these: “Write a function to calculate the greatest common denominator of two positive integers using Euclid’s algorithm.”

Here’s the page if you want to check what’s the Euclid’s algorithm about:


So, here’s my code. Do you see the red chart? Dont’t do something like that. Your code won’t work.

I visited Emanuel’s blog and it was really helpful. I was kind of lost with this code.

I’ll be submitting a flowchart to explain it better.

Here’s my code if you want to check it out. Have a nice day!!!




WSQ12 Word count

This code is not really hard. It’s about asking the user for a word and count how many times does it appear in a .txt file.

Let’s start.

I’ll explain the code that Ken helped me with and then I’ll explain my code.

To count words in a text file you need to consider several things:

The word might have lower and upper case letters on it, or it could be next to other word without any space, so the “split” function won’t help a lot.

So here’s Ken’s code:


As you can see, our big_string has the word “bananas”, but not al the “bananas” have the same structure. So first of all. we shall convert every word to lowercase (line 3).

To give more flexibility to the program, we convert the letters of BaNana to lowercase.

Then, python has this beautiful function that will find the word that we’re looking for (line 7).

After that, what we’ll do is look for the word checking each character, and while the string is not empty, the program will check it and find all the bananas. Kind of funny, right? loved this exercise.

Aaaaand here we go. Here’s my code:


Check that I added an input to catch the wanted word. Also, as my file has several lines, it’s obvious that I need to evaluate them all. That’s why I inserted the “for” loop (line 5)

That’s all for today, fellows. Have a nice day.

(WSQ11) Yo soy 196

After a brain-burning-process, I finally got it. After some appointments to Ken’s office and tons of coffee, Yo soy 196 is here.


First of all, we shall create functions that will help us to find which number is a palindrome, which one can become one and which one is a Lycherel number.

The second part is a BIG piece of code. Here it is:


From line 13 to line 21 I created three lists to add the values depending on it’s category. And of course, I wrote the inputs to get our upper and lower bound to evaluate the range between them.

And trust me, there´s no better way to explain the following lines than with a flowchart, a magical flowchart:wsq1103.png


Last lines are written to print the results.



Lists (WSQ10 )

Hey there! We’ll be developing the WSQ10 assignment in this blogpost.

This code is not difficult but is longer than the rest. Here’s the description:

“Create a program that asks the user for 10 numbers  (floating point). Store those numbers in a list. Show to the user the total, average and standard deviation of those numbers.”

Before we get started, let’s define the average and the standard deviation.

  1. Standard deviation: Is a measure that is used to quantify the amount of variation or dispersion of a set of data values. (Source:
  2.  Average: Is the sume of all the elements of a list divided by the number of elements.

Now, let’s start.


We’ll build this code in three parts. The yellow one is about functions, the green one is the part that will ask the user for the 10 numbers and append them in a list, and the red one will print the results, calling the functions.

The first function is really easy, we just sum the elements form the list in line 20. The second function is the most difficult one. The formula to get the standard deviation, we need to compare each value with the total average, then square that sum, and at the end, divide everything by the number of elements on the list, in this case, 10.
The last function will be the average, we just sum all the elements divided by 10.

Line 27, 28 & 29 are going to call our three functions and print the results.


Here are the results. The program asks the user correctly for 10 numbers and then the list gets printed. after that, as we were waiting, we get the total, the average and the standard deviation.

Here’s my code. If you have a suggestion about how to improve my code, pleas comment bellow.

Have a nice day!!!