Write a Python program that prompts the user to enter a numeric temperature value that may be a float. A second prompt should then ask the user to indicate whether the user wants the entered temperature value converted to degrees Celsius or degrees Fahrenheit by entering either an 'F' or a 'C' for a second prompt. For example, if the user enters 212 at the first prompt and the character C for the second prompt you are to convert 212 degrees F to the Celsius equivalent (which would be 100.0). Converted temperatures should be rounded to 1 decimal place. If the user enters 26 at the first prompt and the character F at the second one, then your programs should convert 26 degrees C to the Fahrenheit equivalent (which is 78.8 deg F) Your conversion formulas are: degF = 1.8 * degC + 32       //convert Celsius to Fahrenheit degC = (degF - 32) / 1.8     //convert Fahrenheit to Celsius

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

Write a Python program that prompts the user to enter a numeric temperature value that may be a float. A second prompt should then ask the user to indicate whether the user wants the entered temperature value converted to degrees Celsius or degrees Fahrenheit by entering either an 'F' or a 'C' for a second prompt.

For example, if the user enters 212 at the first prompt and the character C for the second prompt you are to convert 212 degrees F to the Celsius equivalent (which would be 100.0). Converted temperatures should be rounded to 1 decimal place.

If the user enters 26 at the first prompt and the character F at the second one, then your programs should convert 26 degrees C to the Fahrenheit equivalent (which is 78.8 deg F)

Your conversion formulas are:

degF = 1.8 * degC + 32       //convert Celsius to Fahrenheit

degC = (degF - 32) / 1.8     //convert Fahrenheit to Celsius

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Constants and Variables
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
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