I'm very new to Python and have to make a temperature converter for my class and I have the begining of it here below. It's giving me a syntax error on the Colon and I have tried a semi colon and a comma and have no idea what to do. Like I said brand new to programming so any help at all would be great thanks.
scale = float(input("If you would like to convert to Farenheint, write '1'.
If you would like to convert to Celcius, write '2'"))
if scale == 1 : print("Please print your temperature using numbers only")
I'm getting a syntax error at the end of the float
line. I'd recommend changing your quote ( "
) to a triple quote ( """
), which indicates that you have a block string. Try this:
scale = float(input("""If you would like to convert to Farenheint, write '1'.
If you would like to convert to Celcius, write '2'"""))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.