Python Forum
Temperature converter Help (ASAP)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Temperature converter Help (ASAP)
#1
I am the beginner of python and I encounter some problems that I don't know how to fix it. If anyone could give some feedback to me, I will be very glad for your help.

After I work it and it shows this notification
NameError: name 'Fahrenheit' is not defined
-----------------------------------------------
Write a Python program to convert temperatures to and from Celsius, Fahrenheit.

Hint:

Fahrenheit and centigrade are two temperature scales in use today. The Celsius scale was developed by Swedish astronomer Andres Celsius. Moreover The Fahrenheit scale was developed by the German physicist Daniel Gabriel Fahrenheit. In the centigrade scale, water freezes at 0 degrees and boils at 100 degrees. In the Fahrenheit scale, water freezes at 32 degrees and boils at 212 degrees.
The Celsius to Fahrenheit conversion formula is:
Celsius=5/9×(Fahrenheit−32)
Celsius=5/9×(Fahrenheit−32)
-----------------------------------------------

a= int(input("Input the temperature you?:"))
b= input("Is the temperature in Fahrenheit or Celsius scales?:")
if (b == Fahrenheit):
    print("The temperature in Fahrenheit is:", c= (a * 1.8) + 32)
else:
    print("The temperature in Celsius is:", c= (a - 32) / 1.8)
Reply
#2
Fahrenheit is the name of a variable. 'Fahrenheit' is a string. You need to use the latter in your if statement.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Could someone help me finish this ASAP JimmyDricks 7 2,183 Dec-23-2021, 10:30 AM
Last Post: Larz60+
  My first temperature converter TheLowEndTheory 7 3,338 Oct-18-2020, 04:39 PM
Last Post: buran
  Need help with this homework for a course ASAP...need solution for completion. SP04123 8 4,874 Jun-21-2020, 06:15 PM
Last Post: buran
  really need assistance with this assignment ASAP due tomorrow mohamedhadi02 8 3,456 Jun-21-2020, 09:16 AM
Last Post: mohamedhadi02
  python homework help ASAP gk34332 1 2,942 Mar-13-2019, 07:27 PM
Last Post: ichabod801
  Quiz Game Help (ASAP Please!) beginnercoder04 2 3,161 Apr-15-2018, 04:13 AM
Last Post: beginnercoder04
  Storm Hurricane Tracker (NEED HELP ASAP) zak1206 2 3,795 Nov-13-2017, 02:10 PM
Last Post: gruntfutuk
  how to get the highest monthly average temperature? nikhilkumar 2 6,949 Jul-25-2017, 02:33 PM
Last Post: DeaD_EyE
  Using a range and for loop - temp converter rattlerskin 5 15,577 Jan-20-2017, 09:15 PM
Last Post: sparkz_alot
  Temp Converter with Kelvin vader33 7 12,053 Oct-02-2016, 05:16 AM
Last Post: vader33

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020