Computer Science, asked by anshujha1982, 6 hours ago

Python program to convert Celsius to Fahrenheit and Fahrenheit to Celsius Hint: fahrenheit-(1.8'temperature) +32 Celsius-(temperature-32)/1.8 Estat 1 print("Choose from below options:") print("1. Celsius to Fahrenheit.") print("2. Fahrenheit to Celsius. ) print("option(1/2):-)) if O==1: c=float(input("Temperature in Celsius:º)) f=1.8*() 32.8 print("Temperature in Fahrenheit:",f) lelif o 2: f-float(input("Temperature in Fahrenheit:")) C=(-32)/1.8 print("Temperature in Celsius:", #stat 2 #stat 3 estat 4 #stat 5 print("Choose 1 or 2.")....​

Answers

Answered by arjamesbola07
1

Answer:To convert Fahrenheit degrees into Celsius, here is the formula: °F to °C: Subtract 32, then multiply by 5, then divide by 9. The basic formula is (°F – 32) × 5/9 = °C or precisely (F – 32)/1.8. First step: 98.6°F – 32 = 66.6.

Explanation:

Answered by MichMich0945
0

Program:

from os import system, name  # Will be used to clear the screen

from time import sleep

# Clears the terminal screen

def clear():

   sleep(3)

   if name == 'nt':

       _ = system('cls')

   else:

       _ = system('clear')

# Converts Celsius to Fahrenheit

def c_to_f():

   c = float(input("\nEnter temperature in Celsius: "))

   print(round(c*1.80000+32.00, 2), 'F', sep='')

   clear()

   menu()

# Converts Fahrenheit to Celsius

def f_to_c():

   f = float(input("\nEnter temperature in Fahrenheit: "))

   print(round(f-32/1.8000, 2), 'C', sep='')

   clear()

   menu()

def menu():

   print("-------------\nTemperature Converter\n-------------\n")

   print("\nPlease select an option:\n1) Celsius to Fahrenheit.\n2) Fahrenheit to Celsius.\nEnter any other key to exit.\n")

   o = input("> ")

   if o == '1':

       c_to_f()

   elif o == '2':

       f_to_c()

   else:

       exit(0)

menu()

Attachments:
Similar questions