C2F - computes corresponding Fahrenheit value using...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#this function converts Celsius to Fahrenheit #comments follow pound sign, they are highlighted in red # name of the algorithm, i.e. a function in Python and most programming languages def Celsius2Fahrenheit(): # prints out "Input Celsius temperature: " # then reads keyboard input # then evaluates keyboard input to a number # then assigns that number to the variable called celsiusTemp celsiusTemp = eval(input("Input Celsius temperature: "))
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # computes corresponding Fahrenheit value using appropriate formula # and then assigns the value to a variable called fahrehnheit fahrenheitTemp = celsiusTemp * 9/5 + 32 #prints out the text "Fahrenheit equivalent is" followed by # the value of the variable fahrenheitTemp print("Fahrenheit equivalent is", fahrenheitTemp)...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online