The temperature utility module file has the following code. def CtoF(temp): '''Convert Celsius temperature to Fahrenheit temperature''' return 9 / 5 * temp + 32 def FtoC(temp): '''Convert Fahrenheit temperature to Celsius temperature''' return 5 / 9 * (temp - 32) def CtoK(temp): '''Convert Celsius temperature to Kelvin temperature''' return temp + 273.15 def KtoC(temp): '''Convert Kelvin temperature to Celsius temperature''' return temp - 273.15 The utility.py module is uploaded to zyBook. Write a program that imports the utility module. Using the utility module, write two functions called FtoK() and KtoF() as shown below. def FtoK(tempF) where tempF is Fahrenheit temperature. def KtoF(tempK) where tempK is Kelvin temperature. The temperature program reads two inputs. The first input is Fahrenheit temperature and the second input is Kelvin temperature. It displays the corresponding Kelvin temperature and Fahrenheit temperature. For example, if the user input is: 212 273.15 the output is: 373.15 32.0 You must use the functions found in the utility module. I have an error message saying that the FtoK utility has no attribute, I need some clarification on how it has no attribute when the function has been defined.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 29SA
icon
Related questions
Question

The temperature utility module file has the following code.

def CtoF(temp): '''Convert Celsius temperature to Fahrenheit temperature''' return 9 / 5 * temp + 32 def FtoC(temp): '''Convert Fahrenheit temperature to Celsius temperature''' return 5 / 9 * (temp - 32) def CtoK(temp): '''Convert Celsius temperature to Kelvin temperature''' return temp + 273.15 def KtoC(temp): '''Convert Kelvin temperature to Celsius temperature''' return temp - 273.15

The utility.py module is uploaded to zyBook. Write a program that imports the utility module. Using the utility module, write two functions called FtoK() and KtoF() as shown below.

def FtoK(tempF)

where tempF is Fahrenheit temperature.

def KtoF(tempK)

where tempK is Kelvin temperature.

The temperature program reads two inputs. The first input is Fahrenheit temperature and the second input is Kelvin temperature. It displays the corresponding Kelvin temperature and Fahrenheit temperature. For example, if the user input is:

212 273.15

the output is:

373.15 32.0

You must use the functions found in the utility module.

I have an error message saying that the FtoK utility has no attribute, I need some clarification on how it has no attribute when the function has been defined. 

1 # Define your function here
2 import utility
3
4 def FtoK(tempF):
return tempF + 273.15
6.
7 def KtoF(tempK):
return tempK - 273.15
9 if
_main_':
name
# Type your code here.
tempF = float(input())
tempk = float(input ())
10
11
12
13
tempF = utility.FtoK (tempF)
tempk = utility.KtoF(tempK)
14
15
16
print('{:.2f}'.format(tempF))
print ('{:.1f}'.format (tempk))
17
18
Transcribed Image Text:1 # Define your function here 2 import utility 3 4 def FtoK(tempF): return tempF + 273.15 6. 7 def KtoF(tempK): return tempK - 273.15 9 if _main_': name # Type your code here. tempF = float(input()) tempk = float(input ()) 10 11 12 13 tempF = utility.FtoK (tempF) tempk = utility.KtoF(tempK) 14 15 16 print('{:.2f}'.format(tempF)) print ('{:.1f}'.format (tempk)) 17 18
Program errors displayed here
Traceback (most recent call last):
File "main.py", line 14, in <module>
tempF = utility.FtoK (tempF)
AttributeError: module 'utility' has no attribute 'FtoK'
Transcribed Image Text:Program errors displayed here Traceback (most recent call last): File "main.py", line 14, in <module> tempF = utility.FtoK (tempF) AttributeError: module 'utility' has no attribute 'FtoK'
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Graphical User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning