python 2.7 - Why is there a for in a sentence? -
in python, meet situation there in list. don't know what's meaning of that.
scores = [game.state.getscore() game in games]
i meet in project called pacman, project in ai(artificial intelligence). on 550-580 lines in pacman.py .
this construction called list comprehension
in python. see here more details.
in brief, way of writing code below:
scores = [] game in games: score.append(game.state.getscore())
Comments
Post a Comment