所以我正在研究这款X和O的游戏,在测试时遇到了这个错误,我不知道为什么或如何修复它。当我触发介绍功能并且用户必须选择那里模式时,就会发生这种情况。
####PROGRAM IMPORTS BELOW####
import time
import random
####PROGRAM CLASSES####
####PROGRAM FUNCTIONS BELOW####
def choosemode():
desiredmode = int(input("PLEASE ENTER 1 OR 2 TO PLAY" , '\n' , "OR 3 FOR HTP" , '\n' ))
if desiredmode == 1 :
onep()
elif desiredmode == 2 :
twop()
elif desiredmode == 3 :
HTP()
else :
choosemode()
def gamemodes():
gm1 , gm2 , gm3 = (" 1 PLAYER" , " 2 PLAYER" , " HOW TO PLAY")
print ( '\n' , gm1 , '\n' , gm2 , '\n' , gm3 , '\n' )
return
def boardformat():
print (" 0 | 1 | 2 ")
print ("-----------")
print (" 3 | 4 | 5 ")
print ("-----------")
print (" 6 | 7 | 8 ")
def boardatplay():
print ( b0, "|" ,b1, "|" ,b2 )
print ("--------------------")
print ( b3, "|" ,b4, "|" ,b5 )
print ("--------------------")
print ( b6, "|" ,b7, "|" ,b8 )
def restartboard():
b0 = b1 = b2 = b3 = b4 = b5 = b6 = b7 = b8 = (" ")
def checkforwinx():
if b0 & b1 & b2 == "X" or b3 & b4 & b5 == "X" or b6 & b7 & b8 == "X" or b0 & b3 & b6 == "X" or b1 & b4 & b7 == "X" or b2 & b5 & b8 == "X" or b0 & b4 & b8 == "X" or b2 & b4 & b6 == "X" :
print ("X WINS!")
def checkforwino():
if b0 & b1 & b2 == "O" or b3 & b4 & b5 == "O" or b6 & b7 & b8 == "O" or b0 & b3 & b6 == "O" or b1 & b4 & b7 == "O" or b2 & b5 & b8 == "O" or b0 & b4 & b8 == "O" or b2 & b4 & b6 == "O" :
print ("O WINS!")
def intro():
print ("WELCOME TO X and O's PYTHON EDITION!", '\n' ,"WHAT WOULD YOU LIKE TO PLAY?")
gamemodes()
choosemode()
def onep():
print ( "ONE PLAYER SELECTED!" )
print ( "PLEASE ENTER YOUR NAME" )
name1 = input()
print ( name1 , "VS COMPUTER" )
print ( "PRESS ENTER WHEN READY!")
input()
def twop():
print ( "TWO PLAYER SELECTED!" )
def HTP():
print( "1) To plot a point type the number of the area you want plot in" )
boardformat()
print( "2) " )
####PROGRAM BEGINS BELOW####
restartboard()
print ( "LOADING..." )
time.sleep(4)
print ( "READY!" )
time.sleep(2)
print ( "A EUAN DEAS PRODUCTION" + '\n' )
time.sleep(2)
intro()
我收到错误:
Traceback (most recent call last):
File "C:\Users\Euan\Desktop\Programming stuff\Python\X and O's.py", line 81, in <module>
intro()
File "C:\Users\Euan\Desktop\Programming stuff\Python\X and O's.py", line 54, in intro
choosemode()
File "C:\Users\Euan\Desktop\Programming stuff\Python\X and O's.py", line 11, in choosemode
desiredmode = int(input("PLEASE ENTER 1 OR 2 TO PLAY" , '\n' , "OR 3 FOR HTP" , '\n' ))
TypeError: input expected at most 1 arguments, got 4
答案 0 :(得分:0)
您输入四个字符串作为参数。只需加入他们
"PLEASE ENTER 1 OR 2 TO PLAY\nOR 3 FOR HTP\n"