如果我尝试运行我的代码,则会收到错误消息:
File "main.py", line 80
if Tut_Ans2 == ('Approve'):
^
SyntaxError: invalid syntax
这是完整的代码:
import time
import random
Lives = 5
print ("Hello new recruit, welcome to the bank of \n")
time.sleep (0)
print ("A new law was just passed yesterday.\n")
time.sleep (0)
print ("Now all cheques must be approved by the writer.\n")
time.sleep (0)
print ("You will need to write Approve if they yeet.")
time.sleep (0)
print ("Or Deny if they don't yeet\n")
time.sleep (0)
print ("Oh look, our first customer, I'll show you how to do it.\n")
time.sleep (0)
print ("Okay, so here's the cheque that this person has just given to us.\n")
print (" ")
print (" ______________________________")
print ("| 29/09/06 |")
print ("| From: Cristian Western |")
print ("| To: Charlotte Webb £1200 |")
print ("| Age: 37 Gender: F |")
print ("| Bank of Sandle-land |")
print ("|______________________________|")
time.sleep (0)
print (" ")
print ("And heres the approval cheque from the writer.")
print ("")
print (" ______________________________")
print ("| 29/09/06 |")
print ("| From: Cristian Western |")
print ("| To: Charlotte Webb £1200 |")
print ("| Age: 37 Gender: F |")
print ("| Bank of Sandle-land |")
print ("|______________________________|")
time.sleep (0)
print (" ")
Tut_Ans = input(str("Everything matches up, so now you need to type Approve to approve this cheque.\n"))
if Tut_Ans == ('Approve'):
print ("Good job!\n")
elif Tut_Ans == ('approve'):
print ("Good Job!\n")
elif Tut_Ans == ('deny'):
Lives = Lives - 1
print ("No, these match up.\n")
elif Tut_Ans == ('Deny'):
Lives = Lives - 1
print (("You now have ") + str(Lives) + (" failures left until you're fired!\n"))
elif Tut_Ans != ('approve') or ('Approve') or ('Deny') or ('deny'):
print ("No, you must type approve or deny.")
print ("Here comes another customer.\n")
print ("I'll show you again.\n")
print (" ______________________________")
print ("| 29/09/06 |")
print ("| From: Cristian Western |")
print ("| To: Charlotte Webb £1200 |")
print ("| Age: 37 Gender: F |")
print ("| Bank of Sandle-land |")
print ("|______________________________|\n")
print ("And heres the approval cheque from the writer.\n")
print ("_______________________________")
print ("| 28/7/17 |")
print ("| From: Christian Western |")
print ("| To: Charlotte Web £9000 |")
print ("| Age: 92 Gender: M |")
print ("| Bank of Palm tree |")
print ("|______________________________|/n")
print ("")
Tut_Ans2 = input(str(print("Guess you have to write Deny!"))
答案 0 :(得分:1)
您为什么不尝试
Tut_Ans2 = input("Guess you have to write Deny!")
代替
Tut_Ans2 = input(str(print("Guess you have to write Deny!"))
答案 1 :(得分:1)
您有三个(
和只有两个)
:
Tut_Ans2 = input(str(print("Guess you have to write Deny!"))