Individual means that you do it yourself. You won't learn to code if you don't struggle for yourself and write your own code. Remember that while you can discuss the general (algorithmic) way to solve a problem, you should not even be looking at anyone else's code or showing anyone else your code for an individual assignment. Ask an instructor if you are really stuck and having very specific code problems.
Review the Group Work guidelines on Cavas and/or ask an instructor if you have any questions.
Remember this is on your own. Review the Group Work guidelines and don't forget to try a bunch of stuff, let it not work, try again, etc. You won't break anything!
All test cases should include the code and results. Use markdown to comment on your results.
Define a function called degrees2radians
that:
degrees
. radians
and
In [ ]:
Now call the degrees2radians
function and test that it works using 0°, 90°, 180°, 270°, and any angle of your choice as test cases. (make sure to leave the function calls and output in the notebook!)
In [ ]:
Modify your degrees2radians
function so that it takes the value of the angle as a parameter. Use the # sign to comment out any lines of code that were needed for the prior exercise, but are now unnecessary.
In [ ]:
Now call the new version of degrees2radians
function and test that it works using 0°, 90°, 180°, 270°, and any angle of your choice as test cases.
In [ ]:
Modify your degrees2radians
function so that it takes the value of the angle as a parameter and returns only the variable with the value in radians (and does not print). Use the #
sign to comment out lines that print but are no longer necessary. Do not delete those lines!
In [ ]:
Now call the new version of degrees2radians
function and test that it works using the following test cases (in radians) 0, 1, 1.57, 3.14159, 4.712
, and any angle in radians of your choice as test cases.
In [ ]:
Write a radians2degrees
function that takes the value in radians as a parameter and returns the equivalent angle in degrees.
In [ ]:
Now call the radians2degrees
function and test that it works using 0°, 90°, 180°, 270°, and any angle of your choice as test cases.
In [ ]:
Be sure to spell all function names correctly - misspelled functions will lose points (and often break anyway since no one is sure what to type to call it). If you prefer showing your earlier, scratch work as you figure out what you are doing (as you did in part 1), please be sure that you make a final, complete, correct last function in its own cell that you then call several times to test. In other words, separate your thought process/working versions from the final one (a comment that tells us which is the final version would be lovely).
OK, let's go!
Using the temperature conversion equations from Lesson 1, define a fahrenheit2celsius
function that converts a temperature on the Fahrenheit scale to a temperature on the Celsius scale. Your function should take one parameter and return one value. Be sure to test your function using the oven temperature of 450° Fahrenheit, since you already know the answer to that, and at least 2 other temperatures that you have a good idea what the conversion should be. Please leave all test cases and output in the notebook.
In [ ]:
Define a celsius2fahrenheit
function that converts a temperature on the Fahrenheit to a temperature on the Celsius scale. Your function should take one parameter and return one value. Test your function on at least 3 values that you know are correct. Please leave all test cases and output in the notebook.
In [ ]:
Define a celsius2kelvin
function that converts a temperature from the Celsius scale to kelvins. Your function should take one parameter and return one value. Test your function on at least 3 values that you know are correct. Please leave all test cases and output in the notebook.
In [ ]:
Define a kelvin2celsius
function that converts a temperature in kevlins to the Celsiuse scale. Your function should take one parameter and return one value. Test your function on at least 3 values that you know are correct. Please leave all test cases and output in the notebook.
In [ ]: