简体   繁体   English

If语句Python 3.3.4语法错误

[英]If statement Python 3.3.4 syntax error

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. 我是Python的新手,必须为我的课程创建一个温度转换器,下面是我的起点。 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. float行的末尾出现语法错误。 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'"""))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM