def main():

celsius = float(input("What is the Celsius temperature? ")
fahrenheit = (9/5) * celsius + 32
print ("The temperature is ", fahrenheit, " degrees Fahrenheit.")

main()

error output:
Syntax Error:(line 8) fahrenheit = (9/5) * celsius + 32

This makes perfect sense to me. How can i fix this error?

Recommended Answers

All 4 Replies

a ')' at the end of line 1 is missing:

celsius = float(input("What is the Celsius temperature? "))
commented: sharp eye +14

Also, python is going to round (9/5) to 2 since these are integers. Get in the habit of using floats: (9.0/5.0)

Looks ike you are using Python3, so '/' will be floating point division and '//' an integer division. You can always test drive it ...

Python 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> 2/3
0.6666666666666666
>>> 2//3
0
>>> 

I think it's time for me to start using Python3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.