After the Ending

The last post of the course, yet this feels just like the beginning of my whole life. This time Ken let us be all nostalgic about the course instead of a standar quiz. Which is great since I was going to do this anyway. Sadly, I also have to put a video of this if I want to score a 100% about this. Therefore, you will have the pleasure to hear my Indian English accent at the end of the post even though I am 100% mexican.

fastfurios.jpg

As it may be known, I started the first semester of my career life, and this started with a 0% knowledge of it. This means that I did not even know how to print “Hello World” until now. Therefore, I was highly nervious about this course since I felt as I was going to fail it. Hopefully, a project called #AbolishGrades came from heaven to save my life. Not because I am lazy, but because this is a better style of grading. In Mexico, and several other countries,  we are graded by how much can we memorize and copy & paste it on an exam, yet we forget all about it at the end of the semester. We are even restricted to a limited number of absences. This project vanish all that learning syle since we are graded acording to what we have truly learned. I felt no pressure nor stress about not knowing how to code since this project gave me a chance to truly learn Python by little steps.

Now lets talk about the way Ken Bauer developed this course. If you grade Ken with the qualities a professor needs, Ken would show demonstrate that he deserves to be there. I mean, he clearly know about the course material as well

The Empyrean.png

Continue reading “After the Ending”

WSQ14 ‘Scilab’

Scilab is a open source software used for educational purposes. Ken suggested us to download this software since it is going to be extremely useful in the course of our careers in his opinion. Here is were one can download it and he also posted a PDF manual in order to learn how to use it.  33 pages?! I know, I did not wanted to read it neither. However, when I opened Scilab for first time I had no idea of what to do.

tutorial.png

Other note: This software’s full installation takes 442.9 MB of disk pasce! Which is kind of heavy for me. If my computer dies, I will blame this software for it or perhaps my DS emulator, who knows.

scilab peso

Now that everything is set up, lets beggin using it. Here the ‘language’ or commands to use are actually simple, like Python-simple. However, it has different commands and different structure. For example in python one uses the print() command to return a string a value to the user. In scilab this can be done by using disp(). Also, in python comments are done by using # in here one uses // similar to C++  or other languages. And one fact that called my attention is that one can write different commands in the same line by just separating them with a semicolon (;). This is what I wrote in the editor while testing.
scilab editor

With the console I can made use of matrices, search Wikipedia-style and print a graph. Scilab is an awesome tool so far, yet there is several features to discover. Those kind of features is what we will discover through the course of our careers.

scilab matrice

This is actually the last WSQ of the semester and the next post will be the last one of

favorites

Continue reading “WSQ14 ‘Scilab’”

Extra #2: File editor

While doing WSQ12 ‘Word Count’, I found a way edit a text file and save what the user wants to write. The only problem about it is that this code is in basic phase, and it will overwrite the text file. This means that if you run it twice, the first text that was written in the first run will be deleted in order to write what was given in the second run. Anyways, here is how to do it. You can look it at my GitHub with comments.


text = str(input("Submit what you want to write: "))

file = open(“Test2.txt”,”w”)

file.write(text)

file.close()

 

An empty file was used for testing and this is what happened after the first run of the code.
extra 2

Let’s relax now from this short post. Here is a relaxing song for you: “Run Off The Road” by Ola Podrida. Hope you enjoy the calm of the acoustic guitar and the perfect harmony of the lyrics.
ola podrida.png

Quiz 07 “Dot Product”

One usually learns this chapter in Physics, were we are suppose to get the dot product of two vectors to later get the magnitude of such vector. This can be calculated by multipling the axis values of the first vector with the corresponding axis value of the second vector. Example: V1[x1 , y1 , z1] & V2[x2 , y2 , z2]  then Dp = [x1*x2,y1*y2, z1*z2]. And then the Magnitude is calculated by the square root of  the sum of the values squared. Or something like that, I do not know, do not ask me how I am doing in physics.

knowledge

Why I am telling this? Because we have to make a program that does this for you of course! However, at the end, we are only going to calculate the sum of the Dot Product and not it’s magnitude, shame. Remember that you can check out Ken’s instructions with more precision in his TC101 blog post.

This was succesfully done by the use of two empty list that the user fills by using forin range and inputs inside that operation. After the two list are full, the program multiplies the content of the list by cardinality. Cardinality is used with the symble “[]” such as List1[Cardinality]. This means when cardinality = 1 then it will use the first value of list one and so on. We also had to make the use of conditionals since there is a possibility that the user has one list longer than the other. When that happens, there is a number that misses a pair from the other list to be multiplied by. In this case, the program returns ‘NaN’ which means ‘Not a Number’. This is how the program looks and runs, and remember to keep checking my Github since we

quiz07.png
Hey

Continue reading “Quiz 07 “Dot Product””

Extra #1: Chronometer

I got bored during Vertical Workshop a couple of weeks ago, so I searched of how to do a chronometer. This was succesfully done by the use of import time. Then by using the content within it. There was a glitch were the counter in the first two seconds were almost similar, causing the counter to be delayed for 1 second, so I used +1 in the elapsed time to avoid this glitch. This step made the total of seconds to be increased by one total second. For example, if the user wants to print 10 seconds, the program will return 11 seconds. There is still a problem: every ten seconds the counter delays a maximum of 0.6 seconds. I noticed these by comparing it with my cellphone’s chronometer. Anyways, this is how it looks.
chronometer

This bonus code is also included in my GitHub, so you can get a closer look at it.

Let me introduce you a song from one of my favorite bands. The band is Radiohead and the song is “Nice Dream”, a song released in 1995 as part of the album ‘The Bends’. What I love  about this band is that most of their songs have an acoustic guitar and a calmly tune, this two facts is what I love the most in a song.

nice dream

WSQ13 ‘Second Partial Exam’

We finally reached the end of the second partial and, with it, the second partial of this course. It was similar to the previous exam; however, we had to make four different programs. They were easy, yet I could only make one work correctly since the other three gave me an error I could not fix. You can check the exam problems by clicking here.

partialiimeme.png

The first part of the exam was to find the distance between two points: P1(x1,y1) and P2(x2,y2). This seems familiar right? It is because I have done it before in Quiz III, so you can click on the link to take a loot at that blog post. However, there is a simplier method for this. One can import math and use the hypot function like this:


def Distance(x1,y1):
>Difference = math.hypot(x1-x2,y1-y2)
>return Difference

For the second problem, we had to do a triangle pattern like those you used to comment on other people’s metroflog. The user submits the maximum number of “T” and the program prints “T” starting by one until it reaches such number, and then it goes back to one. For example if the user says the maximum is 4 then the pattern will be like this:

 

 

 

 

 
T
TT
TTT
TTTT
TTT
TT
T

This was done by defining two functions, the first halve and the second halve, with two for in rangeach, one that prints the T in one line and one that controls the flow of the T’s printing per line. One has to use the command end=”” to make sure that the T’s print in the same line. This is the final result, and remember to check my GitHub for a closer look:
Triangulo

For the third part, we had to do

exponent
Here's to you.png

Continue reading “WSQ13 ‘Second Partial Exam’”

WSQ12 ‘Word Count’

The end of the semester is near, and we are seeing more advanced codes that in the beggining of the semester. This WSQ was kind of cool for me, since I enjoyed using the open files as read and writting. I do not know why, but do not judge me.

shiba inu.png

Majo —^

For testing purposes, the text used for this WSQ says the following:

ThisThis This is a test for wsq012 in order to count the words in this file
wsq012
words
thisThis
sentences
allwordstogethertoproveapointallall

I used two methods for this WSQ. The first one was with a line.split() while reading the document. This way the program separates and reads the document line by line. Then search the word in the document with a conditional if. Then it adds the total matches to the counter.

WSQ12v2

As you may notice, this method does not distinguishes the matches of the established word if this word is mixed between the text without any space to separate it. For example, “This” is the word to search. Text says “Thisthis” that are two matches, tecnically; however, the code only recognizes it as one.

This is why I made the second version of the WSQ. Ken suggested to use find() in order to avoid this problem; however, since I failed in using it correctly, I rather used count(). By the way, I also improved the code by using .lower(), so it does not matters if the text and words are submited in cappital letters. 

WSQ12v3

What is this? A picture for ants? Well… you can take a closer look at the code in my GitHub!

Now that this blog has finally reach it’s end. Let me introduce you to Cage the Elephant and their song called “Ain’t No Rest for the Wicked”. Released

no rest for the wicked

Continue reading “WSQ12 ‘Word Count’”

Quiz 06 ‘Greatest Common Denominator’

For this Quiz we had to find the greatest common denominator between two numbers by using Euclid’s algorithm. For example, if x = 6 and y = 12, gdc equals to six. 0,1,2,3,4 are also common denominators but six is the biggest number.

This was successfully done by the use of a recursive function such as the following:

quiz06

By the way, I am no longer using Notepad++ but Atom instead.

 

Quiz 05

My reaction when trying to find out the correct way to program the second part of this quiz:

gato duda

For this Quiz we had two assignments. In the first  one, we had to make a program that let the user know if the word submited is a palindrome or not. I used the [:: -1] to reflect the complete word and then compare the reflection with the original word. I also used the s.lower, so the program ignores capital letters. However, as a cool feature, I made the program ignore spaces since there exist palindromes with spaces. Such as the famous spanish sentence “Anita lava la tina”.

Here is how it looks, and here is how it looks in my GitHub.

quiz05part1

The next step was to do a program similar to the WSQ10. Create a list were the user submits the numbers and play with those numbers. However, the difference was that the operations would only considerate the numbers that are divisable by 3, no remainder.

(Click here for the GitHub of this part)

Several people did this by let the user submit the list as a string separated by commas. That is why I had the reaction of the picture. Yet, with the help of Arturo Fornes, I managed to make eat simplier since he assisted me by correcting what I had done. Just a simple conditional were if i % 3 = 0 then the program appends that number to a separate list.  Then I print the list to let the user know which ones are going to be used for the sum. Finally, just make a simple sum then print it. Such as this:

quiz05part2

Let’s talk about this 80’s oldie. “Maneater” by Daryl Hall & John Oates. A song I first listened to in Metal Gear

maneater

Continue reading “Quiz 05”