2. Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f,  to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter. This function should calculate the equivalent Celsius temperature and return it. In the main function, your program should: prompt the user to enter a temperature (as a float type). indicate the temperature scale of the temperature just entered. call the appropriate function from the temps module. if the Celsius temperature is being determined, it should be displayed accurate to three decimal places. EXAMPLE OUTPUT 1 Enter a temperature 32Was that input Fahrenheit or Celsius c/f? f32.0 Fahrenheit equals 0.000 Celsius EXAMPLE OUTPUT 2 Enter a temperature 100Was that input Fahrenheit or Celsius c/f? c100.0 Celsius is 212.000 Fahrenheit

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

2. Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f,  to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning function defined to take a Fahrenheit temperature as a parameter. This function should calculate the equivalent Celsius temperature and return it. In the main function, your program should:

  • prompt the user to enter a temperature (as a float type).
  • indicate the temperature scale of the temperature just entered.
  • call the appropriate function from the temps module.
  • if the Celsius temperature is being determined, it should be displayed accurate to three decimal places.

EXAMPLE OUTPUT 1

Enter a temperature 32
Was that input Fahrenheit or Celsius c/f? f
32.0 Fahrenheit equals 0.000 Celsius

EXAMPLE OUTPUT 2

Enter a temperature 100
Was that input Fahrenheit or Celsius c/f? c
100.0 Celsius is 212.000 Fahrenheit

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 6 images

Blurred answer
Knowledge Booster
ADT and Class
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education