python - Comparing values in range -
have 2 variables 'wins' , 'clicks' values ranging 1 100k each.
need flag when 'wins' in multiples of 150, , when 'clicks' 0 or 1?
requirement: iteratively want increment both values
if 150<=int(wins)<=300 , 0<=int(clicks)<=1:
need
flagwhen "wins in multiples of 150" , when "clicks0or1"
try
flag = (clicks in (0, 1) , (wins % 150) == 0) clicks in (0, 1): means clicks either 0 or 1(wins % 150) == 0: meanswins % 150remainder zero, win divisible 150.
check following:
>>> clicks, wins = 0, 150 * 7 >>> flag = (clicks in (0, 1) , (wins % 150) == 0) >>> flag true >>> clicks, wins = 2, 150 * 7 >>> flag = (clicks in (0, 1) , (wins % 150) == 0) >>> flag false >>> note: if 'clicks' , 'winds' strings, need use typecase int(clicks), int(wins). in answer both winds , clicks int.
edit: tried make sense of comments , question. may above answer following you:
comment-1: data type int wins , clicks:
if wins , clicks int values don't need use typecase. doing above in answer.
comment-2: want retrieve records
150wins,clicks = 0:
implementing logic simple:
if winds == 150 , clicks == 0: # code retrieve record last:
comment-3: increment
winscounter in multiples150(should retrieve records whenwinsin between150-300,clicks = 0)
4) while incrementingwinscounter need incrementclickscounter retrieve recordse.g. when wins=[300-450] , clicks=1 retreive,
wins=[300-450] , clicks = 2 skip
hard understand! still believe need like:
# `num` until wants execute _ in range(0, num): if clicks in (0, 1) , (wins % 150) == 0: # code retrieve record wins += 150 i don't know why increments clicks, if wants retrieve records clicks value 0, 1.
Comments
Post a Comment