Quizz 1

1. Create a file called prog1.py
Write a program that asks the user for two values (radius, height) of type
float
and returns the volume (V=¶r2*h) of a cylinder with that radius/height as a
float.
Quizz 1 sol 1
 To do this I used this very helpuful website, and my mind. http://www.tutorialspoint.com/python/python_numbers.htm
2. Create a file called prog2.py
Ask the user for two integer numbers, then use those two numbers to calculate and show the following:
* the product of the two numbers
* the INTEGER division of the two numbers

* the remainder from division of the two numbers

Quizz 1 Sol 2

I used the same website to find the solution. I also was not sure about how to integrate the sentences for the results. Turns out you have to divide the different type of « caracters » by a coma.

 3. The same as #2 but use float numbers instead. There will be no remainder, so show the result of addition, subtraction, multiplication and division.
Quizz 1 sol 3

Ok the all floating was a challenge for me. Same I found the solution on the website above.
« float (floating point real values) : Also called floats, they represent real numbers and are written with a decimal point dividing the integer and fractional parts. Floats may also be in scientific notation, with E or e indicating the power of 10 (2.5e2 = 2.5 x 102 = 250).  »

 

CC BY-SA 4.0 Quizz 1 by orianneisprogramming is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.