i have program assign dinners on family. add count down put date and, on 2 weeks repeats event quit person in family. i've done far:
#programa de python para ver el reparto de cenas import time import datetime datetime import datetime, timedelta; #countdays fecha = datetime.today () #hoy quien = 'pirulo' while fecha <= datetime(2016, 3, 31): #condicion while loop nodays = fecha.weekday() #los dias en numeros if quien=='pitulo': quien = 'mengana' elif quien=='mengana': quien = 'fulana' elif quien=='fulana': quien = 'sultana' elif quien=='sultana': quien = 'pirulo' if quien == 'sultana' , (nodays == 1 or nodays == 3): quien = 'fulana' print (fecha.strftime('%d/%m/%y') + ': ' + quien + " /"+str(nodays)) #el out en la pantalla fecha += timedelta(days=1) #que al dia anterior le suma uno mas
what want 'fulana' quitted of family on 2 weekends.
if understand question correctly, trying make "abril" included in rotation every other week. try creating condition , switching condition's value every time new week rolls around. include "abril" when condition true
, not include when condition false
. like:
condition = true # new condition while ...: # main while loop nodays = fecha.weekday() # switch condition on sunday if nodays == 6: condition = not condition # update quien if quien=='ale': quien = 'judith' elif quien=='judith': quien = 'jazmin' elif quien=='jazmin': quien = 'abril' elif quien=='abril': quien = 'ale' # check if including 'abril' if quien=='abril' , not condition: # replace 'abril' quien = 'ale' # skip on 'abril' rotation ...
maybe helps. let me know if not looking for.
Comments
Post a Comment