import time
def pini():
pin1 = int(input("enter your pin please: ")
if pin1 == pin:
print("pin correct")
print("paying: £",amount)
print("opening connection...")
time.sleep(0.4)
print("contacting bank...")
time.sleep(1.0)
print("contacting bank...")
time.sleep(0.5)
print("contacting bank...")
time.sleep(0.2)
print("contacting bank...")
time.sleep(0.2)
print("transaction successful")
elif:
print("wrong pin, try again")
pini()
print("Welcome to the bank")
print("\n")
pin = int(input("what is your pin: ")
pay = ""
while pay == "":
pay = input("press 'n' to make a payement: ").lower()
if pay == "n":
amount = int(input("please enter amount to pay: ")
print("please insert your card to pay" , "£",amount)
print("\n")
pini()
這是我的代碼。運行我的代碼時出錯(語法無效)
運行時,出現「無效語法」錯誤,我正在使用Python/IDLE 3.4.2。 這只是一個學校項目的一個小程序,我遇到了一個錯誤。
我認爲可以縮進這是問題,但否則我不知道,任何幫助讚賞:)
)在輸入中缺失 –
在所有的'int(input(「))'調用中,您忘記關閉外部圓括號。 I.e'int(輸入(「請輸入你的PIN:」)' –