我是python新手。到目前为止,它看起来是非常基本和可以理解的。我决定重新写洞脚本,现在它给了我 第11行:语法错误:输入错误('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#
让我们先做语法错误
第8行缺少
)
第9行末尾缺少冒号(
if...:
)第17行缺少
)
在第25行,不能有空的
else
块第28行缺少
)
第34行缺少
,
第37行缺少
)
现在要了解更多错误:
这句话永远是真的
^{pr2}$您需要将
input()
的结果分配给一个变量-也不需要print
等等
您的逻辑流程似乎有缺陷,或者您没有意识到嵌套的
if
块也必须通过缩进进行嵌套。在相关问题 更多 >
编程相关推荐