Answer to Question #166308 in Python for Okeino

Question #166308
Requirements: Python

The task is to build the simple function to calculate the metric into temperature conversion inscribed.

in a celsius with the fahrenheit

Design:

The solution to this task is simple: the metric into temperature inscribed

in a metric e with the certain temperature a is equal to -115.15ºC. However degrees Fahrenheit is not a native python variable. We can find degrees Fahrenheit in math module that we need to import in advance.

The desired function will return the degrees Fahrenheit value to the user
1
Expert's answer
2021-02-24T10:40:52-0500
temp = input("Enter the  temperature you like to convert? : ")
deg = int(temp[:-1])
i_convention = temp[-1]

if i_convention.upper() == "C":
  result = int(round((9 * deg) / 5 + 32))
  o_convention = "Fahrenheit"

elif i_convention.upper() == "F":
  result = int(round((deg - 32) * 5 / 9))
  o_convention = "Celsius"

else:
  print("Input proper convention.")
  quit()
print("The temperature in", o_convention, "is", result, "degrees.")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS