Quiz Week 3

Functions

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

  • def square_root(x):  // returns the square root of x (float)
  • def cube_root(x): // returns the cube root of x (float)

What to Do

You implement this function in your own program in a file quiz3.py.

You should make a main routine that asks the user for a number and then calls your functions to calculate the square and cube roots of that number and prints them out.

What should you do if the user enters a negative number?

Publish your code on your own blog today (during class time is best) and use the tag #Quiz03 so it shows up nicely in our tag cloud.

Feature Image Credit

<a title="Square roots" href="https://flickr.com/photos/ronaldc5/14927947186">Square roots</a> flickr photo by <a href="https://flickr.com/people/ronaldc5">Ronaldc5</a> shared under a <a href="https://creativecommons.org/licenses/by/2.0/">Creative Commons (BY) license</a> </small>
Square roots flickr photo by Ronaldc5 shared under a Creative Commons (BY) license

CC BY-SA 4.0 Quiz Week 3 by admin is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.