Despues de mucho tiempo! aqui el video.
In this Quiz I needed to create 3 programs, they were very easy. In the first one I needed to create a program to get the volume of a cylinder with a given radius and height by the user.
The second program was about making multiplication, division and getting the reminder between two numbers.
The third and last part of the quiz was making something similar of the second program but now with addition and substraction.
The quiz was easy, I finished it in time in class.
Este es el primer quiz del curso de la materia Soluciones de problemas con programación, este quiz consiste en la elaboración de 3 programas, con la finalidad de reforzar los temas vistos en los primeros WSQ’S.
Gracias a este programa, el usuario puede obtener el volumen de un cilindro, esta es la primera vez que utilizo el tipo float, que consiste en poder trabajar con números decimales.
Link GitHub: Quiz 1 prog 1
Este programa es similar al WSQ03, el cual consiste en realizar las siguientes operaciones:
- División con residuo
En este caso no se utilizó float, sino que se utilizó int.
Link GitHub: Quiz 1 prog 2
Este es el ultimo programa realizado para este primer quiz, muy parecido al programa 2, esta vez, el programa no te da el residuo de la división, esto es porque se utilizó el tipo float, por lo tanto se utilizan decimales.
Link GitHub: Quiz 1 prog 3
(credits goes to http://9gag.com/gag/aD0PNnK)
☞ The second program requested the user for two integer numbers, then use those two numbers to calculate and print the following:
* the product (multiplication) of the two numbers
* the INTEGER division of the two numbers
* the remainder from division of the two numbers
☞ The third one asked for the same as #2 but usingfloat numbers instead, in this program there won’t be remainder, so itshows the result of addition, subtraction, multiplication and division.
Well quiz 1 really woke us up didn’t it? We had to do three programs in one quiz. This time is different from my previous posts. Usually I give a link to my original, more complex code and a link to a simpler code that gets the job done. This time I’m not gonna make a tutorial but rather explain how my programs work and why they work.
The first one is to calculate the volume of a cylinder, the second is to do a program similar to WSQ03 using type int and the last one was the same as the second one expect using type float.
Here is the quiz(I got it from ALEXHFOO‘s BLOG):
And now for the explanation on how these programs work.
Made by Orlando Lara
First quiz, and as I had no computer to work with, I answered it on paper. The first step was to create a python file named prog1.py that contains a function that has a cylinder’s radius and a height as parameters and outputs the cylinder’s volume. Now let’s test what I did:
There’s the function, but that’s just the beginning, let’s test it, of course :
To prove my answer as correct I called my function with a and b as parameters, when a and b are inputs by the user, raw_input returns data as strings, that’s why I call float on it. Here I am using python 2.7.11, if you are using python 3 you’d have to change raw_input for input and add parentheses when calling print on volume: print(volume(a, b)).
Next is the second part. As expected, the new python file is named prog2.py, it should ask for two numbers and return their product, their integer division, and the remainder from their division. This is what I turned in :
This second part didn’t ask to use float numbers, but integers, thus int is called on the input. It wasn’t necessary to edit this any further to prove the answer correct, as it proves itself.
This is my post for the first quiz on my Programming Fundamentals course.