comment-2: I want to simply retrieve the records with say 150wins and clicks = 0:
实现这个逻辑非常简单:
if winds == 150 and clicks == 0:
# code to retrieve record
最后:
comment-3: Increment wins counter in multiples for 150 (should retrieve records when wins is in between 150-300 and clicks = 0)
4) While incrementing wins counter I also need to increment clicks counter to retrieve records
e.g. when wins=[300-450] and clicks=1 retreive,
wins=[300-450] and clicks = 2 skip
很难理解!我仍然相信你需要这样的东西:
# `num` until you wants to execute
for _ in range(0, num):
if clicks in (0, 1) and (wins % 150) == 0:
# code to retrieve record
wins += 150
试试看
clicks in (0, 1)
:表示单击次数为0或1(wins % 150) == 0
:意思是wins % 150
余数为零,所以win可以被150整除。你知道吗检查以下内容:
注意:如果'clicks'和'winds'是字符串,那么您需要使用typecase
int(clicks)
,int(wins)
。在我的回答中,风和点击都是int编辑:我试图理解你的评论和问题。以上答案可能对您有所帮助:
如果
wins
和clicks
是int
值,则不需要使用typecase。只要照我上面回答的做就行了。你知道吗实现这个逻辑非常简单:
最后:
很难理解!我仍然相信你需要这样的东西:
我不知道为什么你要增加点击次数,如果你只想检索点击次数的记录值0,1。你知道吗
相关问题 更多 >
编程相关推荐