Lesson1 Individual Assignment

Programming Practice

part 1

Write at least five lines of Python code that:

  • Create a variable oven and set it to 450 degrees Fahrenheit
  • Create a variable celsius and use oven and equation 1 from the preactivity to calculate the oven’s temperature in degrees Celsius
  • Create a variable kelvin and use celsius and equation 2 from the preactivity to calculate the oven’s temperature in kelvins
  • Print your celsius answer
  • Print your kelvin answer

In [ ]:

Be sure to compare your answer to what you calculated as the pre-activity. If you get a different answer, review the actual Python output in Models 1 and 2.

part 2

Now add a way for a user to input a temperature in Farenheit then convert it to both celsius and kelvins. Make sure that you communicate with the user in when gathering input and printing results. Do all of this in a single code cell.


In [ ]:

make sure that you test your code with 450 and at least one other temperature that you can verify so that you know your code functions reasonably well. these are called test cases and we will be doing things like this a lot.

Describe the test cases and results.

Self Assessment

Find a line of code from today’s activity that exemplifies each of the following programming terms. Copy and paste the code into a markdown cell below, formatting the example of the term in the line of code as bold italic.

For example, for the term “expression”, a line of code would be:

hot = ***273 + 100***

where ***273 + 100*** is the example of an expression and is bold italic.

now you do these (each in their own cell):

  • assignment statement (bold italic the assignment operator)
  • identifier
  • calling a function (bold italic the function name)
  • argument