playerA=input("Please choose one from rock paper and scissors")
playerB=input("Please select one from rock paper and scissors")
if playerA=rock and playerB=paper:
print("player B wins")
elif playerA=scissor and playerB=paper:
print("Player A wins, Congratulations Player A. Do you want to play
another game? ")
elif playerA=rock and playerB=rock:
print("game is draw, Do you want to play another game")
elif playerA=paper and playerB=paper:
print("game is draw")
elif playerA=scissor and playerB=scissor:
print("game is draw")
elif playerA=paper and playerB=scissor:
print("Player B wins, Congratulations Player B. Do you want to play another game?")
elif playerA=scissor and playerB=rock:
print("Player B wins, Congratulations Player B. Do you want to play another game?")
elif playerA=rock and playerB= scissor:
print("Player A wins, Congratulations Player A. Do you want to play another game?")
elif playerA=paper and playerB=rock:
print("player A wins, Congratulations Player A. Do you want to play another game?")
我可以知道如何修复这里的缩进,我得到的错误就是说 unindent与任何外部缩进级别都不匹配。
答案 0 :(得分:0)
您是否尝试在'if'后面只输入一个空格而不是标签?
if playerA==rock and playerB==paper:
会变成:
if playerA==rock and playerB==paper:
另外,你的第二个elif还有一个空格。删除它也应该有所帮助。
答案 1 :(得分:0)
您需要取消缩进所有代码,然后使用tab进行正确的缩进。你有一个标签和空格的混合,这就是问题所在。
您还可以使用在Python安装的reindent.py
目录中找到的Tools/scripts/
脚本。更改Python(.py)文件以使用4空格缩进而不使用硬标签字符。还可以从线条末端修剪多余的空格和标签。同时确保最后一行以换行符结束。
答案 2 :(得分:0)
在此代码之后移除elif之前的空格..
`elif playerA = paper和playerB = paper: 打印(“游戏是画画”)
elif playerA =剪刀和playerB =剪刀: 打印(“游戏是画画”)`
答案 3 :(得分:0)
删除else语句。喜欢这个
否则 只要 不需要陈述