我是靠谱客的博主 潇洒咖啡豆,这篇文章主要介绍pythonfor循环if中断怎么使用_python在for循环中中断if语句,现在分享给大家,希望可以做个参考。

试试这个:def pTurn(CampLoc, AICampLoc, score, yourHits, cHits):

if yourHits < 5:

#^This line ident is probably the offending line. ;)

hGuess = int(raw_input("Enter a co-ordinate to air-strike: "))

print "Air-striking co-ordinate: %d" % hGuess

for cSpot in AICampLoc:

if hGuess == cSpot:

yConfirMsg = "Kill confirmed!!"

yourHits += 1

score += 100

AICampLoc.remove(hGuess)

break

else:

yConfirMsg= "No casualties"

score = score #You may want to fix this, since the logic doesn't make sense

yourHits = yourHits #Fix this line as well. This is variable value assignment to the same variable.

如果这不起作用,另一件要考虑的事情是,在缩进代码的前导空格时,可能会无意中混合使用制表符和空白。如果是,请将所有选项卡转换为空格。

关于引用的注释。也许你是想回报那些价值观?如果是的话,你需要修

最后

以上就是潇洒咖啡豆最近收集整理的关于pythonfor循环if中断怎么使用_python在for循环中中断if语句的全部内容,更多相关pythonfor循环if中断怎么使用_python在for循环中中断if语句内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(123)

评论列表共有 0 条评论

立即
投稿
返回
顶部