Quiz W4 -Minimum and squares

And second quiz today, for week 4 this time. Same idea, using functions to compute the minimum and the sum of squares of three numbers.

Here were the instructions:

For this quiz I want you to (in class) create a program with two functions:

  • def minimum_three(x, y, z):  # returns the value that is smallest of x, y and z
  • def sum_squares(x, y, z): # returns the value of the sum of squares of x, y, z

This the solution I’ve come up with :

quiz4

It uses the built-in function min() that returns the smallest number from a bunch of numbers, and uses the same idea than on quiz w3 to check for the user input to make sure it can be converted to an integer.

Leave a comment