WSQ09 Factorials!

This time we have to do factorials. This means n! = (n)(n-1)(n-2)…(1). Multiply n times the previous number until it reaches 1.

For this I used a for in range (1, x + 1) . When x is the value that the user inputs. The, y = y*i so it keeps repeating itself until it becomes 1. Secondly I used conditionals to predict the parameters when x is 0 or when x is a negative, so the program gives the obvious.

Finally, I took a peek at my classmates’s blog to learn what to do in order to let the user try again or exit the program. Thanks to Pxthon Progrxmmer I learned that you can use a while True to make the whole conditionals and the factorial formula work and when it ends let the user try again by typing ‘a’ or exit by typing a different letter.

wsq009.png

Today’s song is ‘Short Change Hero’ by The Heavy. A song that is used at the intro of Borderlands 2 when introducing the main characters. It is an epic way to show the players what they will meet in the world of Pandora because Pandora “ain’t no place for no hero”.

short change hero

Partial Exam

partial1reaperToday the partial exame was given to us. They were all open questions to explain what you’ve learned so far. Remember that this is a prototype class for #AbolishGrade so it is not that drastic. That means that it is just to follow us on the process of learning; however, it is okay if you fail to answer the exam.

The first partial exam came in a format like this:

Firstpartialexam

Blog under construction… 

 

 

Quiz III

Brace yourselves, the partial is coming. Meanwhile, we have to answer a third quiz.

quiz3instructions.png

At the first point we had to find the distance between two points. If you represent this as an a triangle, it would be like Image 1 where A is (x1,y1) and B is (x2,y2), so we had to find the value of h.

2000px-trigonometry_triangle-svg
Image 1

At first I tried to find the distance between each axis. This means what is the difference of x1 and x2 and what is the difference between y1 and y2. This got complicated to me since distance is absolute, yet the answer was given as negative in some occasions. This got fixed when I used a conditional to multiply it by -1 to make it positive.

 

Then I got to the point to find h. I used the basic pythagoras theorem (C^2=A^2+B^2)  and then use the squareroot to get the answer. Ken teached me that there was a simplier way: use the distance command. Yet, It have me errors when running so I kept it at my mode since it works. Of course this does not means I am not going to fix what Ken helped me with. The code and how it runs looks like this:

pythagoras

For the second part of the quiz I had  a big time learning what to do. Firstly because I did not even know what the Fibonacci Numbers are. After I knew what they are, I searched all over the internet to see how to do it. Technobeans showed me 5 different methods of how to do it; however, Naren’s method in the comments helped me better.

fabonacci

Remember to keep checking my GitHub to see the code clearer.

Time for you to meet Bloc Party’s “Helicopter”. I got into this band because of

helicopter

Continue reading “Quiz III”

WSQ08 ‘WSQ03 Version 2.0’

This ‘On To Functions’ WSQ is kinda weird. The instructions were the same as WSQ03 with only one difference: Separating the operations from the answer’s printing.

This is how WSQ03 looked like. And this is how it changed:

WSQ08code

It still runs the same in case you were wondering.

WSQ08run

This may be a short post, but the reason is that the changes were minimal. Well then, lets talk about a classic. “The Man Who Sold The World” by David Bowie. Not so long ago, this same man passed away. I always knew about this classic; however, I got the interest into it because of Metal Gear Solid V: The Phantom Pain. Even so it is a cover of this song, the lyrics match what ‘Venom Snake’ is going through. David Bowie gave this song a meaning of existentialism  because he portraits his two selves: the image he sold to the world and the his true self negating each other.

The Man who sold the world

WSQ07 ‘Sum of Numbers’

Ever wondered what is the result of the addition of all the intergers from a certain range? Of course not, but let’s calculate it!

okami doge
Sorry, been playing Okami lately. 

What I mean by ‘Sum of Numbers’, it is for example: from a range of 5 to 10 one has to sum 5 + 6+ 7 + 8 + 9 + 10. This has to be done in order to get the final result of 45.  Sounds easy right? But what if the range was bigger? For example from 1 to 100. One is not going to grab a calculator and start “1+2+3+4+5+6+7+8+9+(…)+100”. Of course not! This is why I was in charge of programming a code were the computer automatically does this.

 

 

I will be using the classic variables “x” and “y” to define the range. This time “x” is the number we begin, and “y” is the number the addition countdown stops. However, I had to make a prediction were the user actually submits “x” higher than “y”. This would me impossible since the program is unable to count backwards. So I used a conditional “If” to let the user know what the mistake is. In the end, this is my code.

WSQ07 code

Looks cool right? It looks better when one uses it.

wsq07run

This blog corresponds to the song “After Midnight” by Blin182. I am not that old, yet I know that band brings nostalgia to most of the 90’s kids. This song was recommended by an old friend of mine, and I have must say thanks to her for introducing me this awesome song.

After Midnight

 

WSQ06 Guess my number

 

picture079
Hello user. I want to play a game.

I am thinking of a number from 1 to 100, and it is not a decimal. Guess it or Game Over!

 

 

 

 

For this WSQ06 we had to program the system to take a number from the range 1 to 100. At this case we have to use the function rand_num and make it interger with randint(1,100) . The main point at this program is to play the “warm or cold” game where you give the player the clue that his guess was higher or lower than the actual number.

This is were one uses the conditionals if and elif, so one predicts all the possible answers from the user. If guess is higher than random number then it prints that the guess is higher. And viceverse if the number is lower.

At first I had troubles printing the “You win!” screen message.
randomnum question

Then I noticed that the last “elif” has to be written as “else” since it is the last option from the conditionals. This is without the actual condition “==”. Also, there was a problem with the indent since “else” has to match the “while” position. Like this:

wsq06 win.png

I did not used a conditional if the user tries a number higher than 100. This is because the program will tell the user to try a lower number. Everything is ready to go. Now let’s play!

wsq06 win

The WSQ06 is over, but I challenge myself to learn how to tell the user’s tries and to limit the game to an actual number of tries. This is in order to make a “Game Over” screen possible.

Today’s blog corresponds to the song “Swing Life Away” by Rise Against. No,  not Rage Against the Machine but Rise Against.  A song

swing life away

Continue reading “WSQ06 Guess my number”

Second Quiz

Another class, another quiz.

This time we were in charge of making loops. However, since I found out a the easy way, I used those methods.

For the first part we were in charge of ‘a’ be at ‘b’ power. In Python 3 this operatios is represented with “**”. So the code looks somehow like this:

quizpower.png

Then the second question requested us to print “*” a certain number of times in the same line. Even so it was forbidden, I used multipications to print x number of times the symbol “*”. Yet, I could not find out a way to print it at the same line. Still in the process of exploring other people’s blogs to see the other way to do this two exercises and to find out how to print in the same line.

Here code for part 2:

printstars.png

And this is how it runs!

printstars.png

WSQ04 “Flipped Learning”

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.”

This was a famous phrase that, according to the internet but not confirmed, was said by Albert Einstein.

This course with Professor Ken Bauer is a ‘Prototype course’ for #AbolishGrades. What does this means? This means that instead of the classic education system where one either ace an exam or fail it in order to judge one’s intelligence one must show what they truly learned at the course. This will be written by using as a source the lecture “An A+ student regrets his grades” from Afraj  Gill.

Lets be real. This may be more common between the ‘millennials’ since they are all around social media over the networks. Is a common meme when one experencies forgeting what one learned trough a year or semester of school. Think about it. Do you remember most of what you answered at last semester’s exam? It could be like that Men In Black movie where one forgets instantly what they just learned.

men in black.jpg

Secondly, have you ever asked what an entrepreneur’s scores where? Of course not! Because that does not matters anymore when one sees how far they have gone. Einstein dropped school for example. Scores are nothing but just numbers to label one, yet it does not define one’s true knowledge.

Now, let’s discuss the experience at Ken Bauer’s class specifically.

exp.pngAs one may recall, the writter of this blog is a begginer at coding. That means that he barely knows what he is doing and how he is going to do it. The expectations for this class were high form him. Because he was expecting a classic educational system so he was sort of afraid

the blakes

Continue reading “WSQ04 “Flipped Learning””