Question: Run below program in Python and explain 1. F = raw_input(Enter a temperature in Fahrenheit: ) F = float(F) C = 5 / 9. *
Run below program in Python and explain
1.
F = raw_input("Enter a temperature in Fahrenheit: ")
F = float(F)
C = 5 / 9. * (F - 32)
print "%g Fahrenheit = %g Celsius" % (F, C)
2.
import sys
F = float(sys.argv[1])
C = 5 / 9. * (F - 32)
print "%g Fahrenheit = %g Celsius" % (F, C)
3.
import sys
try:
F = float(sys.argv[1])
except IndexError:
print 'You failed to provide a temperature in Fahrenheit '\
'as input on the command line!'
sys.exit(1)# abort
C = 5. / 9 * (F - 32)
print "%g Fahrenheit = %g Celsius" % (F, C)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
