Oct-02-2016, 05:16 AM
(Oct-01-2016, 11:35 PM)ichabod801 Wrote: You calculate the output variables, but you don't actually use them in the output. You output tempFormatted, but that is calculated off of temp, which is the original input. You need to calculate tempFormatted from fahrenTemp or celsiusTemp, and then print that. But not that you need to figure out which two calculated variables to output based on the which variable. You are basically already do that when you are calculating them, so you should probably just output them when you calculate them.
You're exactly right. I see where I went wrong and made the changes. It took a little doing (this is only my 4th class in Intro to Programming lol), and here's what I came up with:
if which =='F': celsiusTemp = (temp - 32) * 5/9 kelvinTemp = (5/9 * (temp - 32) + 273.15) tempFormattedC = format(celsiusTemp, '4.1f') tempFormattedK = format(kelvinTemp, '4.1f') print('The converted temperature in Kelvin is', tempFormattedK) print('The converted temperature in Celsius is', tempFormattedC)I just followed the same format for conversions with Celsius and Kelvin, and everything works as it should. Thanks for your help!