Variable Reassignment (Expressions and Variables)
Using a single variable convert a temperature of 42 degrees Fahrenheit to Celsius. To do this you’ll need to:
- Assign the number 42 to a variable
- Subtract 32 from it and assign that value back to the same variable
- Divide the current value by 9 and assign that value back to the same variable
- And then multiple the current value by 5 and assign that value back to the same variable
- Print the temperature in degrees Celsius
The answer should be 5.55555. If it isn’t then that pesky integer division problem is probably tripping you up.
Now do the same thing again, but this time using combined operators, and a starting temperature of 98.6 degrees.
Expected outputs for Variable Reassignment: