Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

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)
Quote
#2
Fahrenheit is the name of a variable. 'Fahrenheit' is a string. You need to use the latter in your if statement.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Quiz Game Help (ASAP Please!) beginnercoder04 2 304 Apr-15-2018, 04:13 AM
Last Post: beginnercoder04
  Storm Hurricane Tracker (NEED HELP ASAP) zak1206 2 376 Nov-13-2017, 02:10 PM
Last Post: gruntfutuk
  how to get the highest monthly average temperature? nikhilkumar 2 837 Jul-25-2017, 02:33 PM
Last Post: DeaD_EyE
  Using a range and for loop - temp converter rattlerskin 5 1,912 Jan-20-2017, 09:15 PM
Last Post: sparkz_alot
  Temp Converter with Kelvin vader33 7 2,413 Oct-02-2016, 05:16 AM
Last Post: vader33

Forum Jump:


Users browsing this thread: 1 Guest(s)