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.
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
Continue reading “After the Ending”
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.
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.
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.
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.
This is actually the last WSQ of the semester and the next post will be the last one of
Continue reading “WSQ14 ‘Scilab’”
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”)
An empty file was used for testing and this is what happened after the first run of the code.
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.
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.
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 for i in 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
Continue reading “Quiz 07 “Dot Product””
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.
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.
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.
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:
>Difference = math.hypot(x1-x2,y1-y2)
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:
This was done by defining two functions, the first halve and the second halve, with two for i in range each, 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:
For the third part, we had to do
Continue reading “WSQ13 ‘Second Partial Exam’”
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.
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
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.
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.
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
Continue reading “WSQ12 ‘Word Count’”
My reaction when trying to find out the correct way to program the second part of this quiz:
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.
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:
Let’s talk about this 80’s oldie. “Maneater” by Daryl Hall & John Oates. A song I first listened to in Metal Gear
Continue reading “Quiz 05”
For this one, we were in charge of letting the user sumbit 10 numbers and play with them. The point of this WSQ was to append the 10 numbers that the user sumbits to a list, and us to program different operations with those numbers. In this WSQ, I learned a bunch of codes and strategies. For example:
- x =  has to be empty in order to let the user fill the x with the 10 digits he submits.
- x.append(float(input)) so the program fills x with the digits.
- import statistics so I am able to use statistics functions since the WSQ requested standar deviation. This is easier than to search for the formula and manually code it.
At any case this is how the code looks and runs , and here is the GitHub to analyse it closer. I made the comparision with a random webpage to double check it was correct.
This blog is sponsored (I wish) by Jack Dolgen’s “I Will Come For You”. As part of How I Met You Mother’s soundtrack, this song is full of feelings. This song is played during one of the saddest moments of the show, episode 19 of season 6. A kid needs a hoop…
If x = 5, what is the mass of the sun?
That same reaction was what I had when I got in charge of doing Quiz 04. This time we had to make the sum of 1 divided by n! factorial. This until it reaches the euler number = 2.71 and it stops looping around.
I broke my head constantly for several days trying to reach the answer for this equation in python3 language. This was until Ken Bauer miraculously helped me out and teached me what means each step means. I am not trying to pass the course by copy pasting codes. It is just that I have to see what is happening in a code first and then analyse it. This is in order to learn what to do and use it for future references. For instance, from the previous WSQ09 i learned to do factorials, so that was a piece of cake in this quiz. This is the code:
And this is how it runs:
When n! is 18 and n! is 19, the answer it is the same. That moment it is when it stops.
I am going to introduce another David Bowie’s song over here just for one reason, maybe a slowpoke one since I just realized it. This one is called Lazarus. It was released in his most recent album Blackstar in 2016. This song got his video release 3 days before he passed away in January 10th 2016. It is a really sad song. Was he saying goodbye? Who knows, but it gives this song even a bigger meaning. May he rest in peace.