语法错误第11行:SyntaxError:错误输入(' print')

时间:2015-12-15 02:23:32

标签: python

我是python的新手。到目前为止,它看起来非常基本且易于理解。我决定重新编写孔脚本,现在它给了我 第11行:SyntaxError:输入错误(' print') 知道为什么Print会出现语法错误吗?

注意:我在尝试将代码粘贴到"时遇到了麻烦。

#START OF CALCULATOR CODE#
print(input("Thank you for calling how may I help you?"))
name = input("Okay Whats your name?")
print (input("Thank you " + name + " And can I have your number?"))
print (input("Do you live around the 84041 area??"))
if "Yes" or "":
    print "Okay, " + name + " Dilivery time will be 30 mins"
    print (input("Would you like a 12 Inch pizza with that?")
if "Yes" or ""
    print "Okay, " + name + " Your pizza is now being made and will be dilivered to you soon."
    basepizza = 5
    basecharge = 5
    diliveryprice = 6.5
    print ("Okay, Your total cost comes out to",basepizza,diliveryprice,basecharge)
    print "Thank you!"
if "No":
    print int(input("How many inches would you like?")
if inches>12:
    inchprice = 0.5
    inchprice = (inches/2)+inchprice*(inchprice+0.5)
    basecharge = 5.0
    diliveryprice = 6.5
    print ("Okay " + name + " Your total cost comes out to", inchprice,diliveryprice,basecharge)
    print "Thank you!"
else:  
if "No":
    print "Okay, " + name + " Dilivery time will be 45Mins"
    print (input("Would you like a 12 inch pizza with that?")
if "Yes" or "":
    print "Okay, Your pizza is now being made and will be dilivered too you shortly. Thank you!"
    basepizza = 5
    basecharge = 5.0
    diliveryout = 7.5
    print ("Your toal cost is"basepizza,diliveryprice,basecharge)
    print "Thank you!"
if "No":
    print int(input("How many inches would you like?")
if inches>12:
    inchprice = 0.5
    inchprice = (inches/2)+inchprice*(inchprice+0.5)
    basecharge = 5.0
    diliveryout = 7.5
    print ("You're total cost will come out to",inchprice,diliveryout,basecharge)
    print "Thank you!"
#END OF CALCULATOR CODE. ENJOY#

Python syntax error line 11, ON PASTE BIN

1 个答案:

答案 0 :(得分:4)

让我们先做语法错误

您在第8行缺少)

您在第9行(if...:

的末尾缺少冒号

您在第17行缺少)

在第25行,你不能有一个空else

else:  
if "No":

你错过了第28行的)

您在第34行缺少,

你在第37行错过)

现在有更多错误:

此表达式将始终为True

if "Yes" or "":

您需要将input()的结果分配给变量 - 也不需要print

live_close = input("Do you live around the 84041 area??")
if live_close in {"Yes", ""}:

您的逻辑流程似乎存在缺陷,或者您可能没有意识到嵌套的if块也必须通过缩进嵌套。

相关问题