sa 12 cs chapter 4

1. Create module tempConversion.py as given in Fig. 8.2 in the chapter. If you invoke the module with two different types of import statements, how would the function call statement for imported module’s functions be affected ?

# tempConversion.py “””Conversion functions between fahrenheit and centrigrade””” # Functions def to_centigrade(x): “””Returns: x converted to centigrade””” return 5*(x-32)/9.0 def to_fahrenheit(x): “””Returns: x converted to fahrenheit””” return 9*x/5.0 + 32 # Constants FREEZING_C = 0.0 # water freezing temp.(in celsius) FREEZING_F = 32.0 # water freezing temp.(in fahrenheit) # programme import tempConversion print(tempConversion.to_centigrade(10)) # prefix

1. Create module tempConversion.py as given in Fig. 8.2 in the chapter. If you invoke the module with two different types of import statements, how would the function call statement for imported module’s functions be affected ? Read More »