r/learnpython • u/blackgarliccookie • 19m ago
Turning 19 boolean variables into 1.
I'm back again, hopefully with clearer information.
I have 19 boolean variables. Each one is labeled with the date of an election. Inside the variable has true/false. True is voted, False is didn't vote.
I want to create a voting history variable that has a few options.
Never voted, if all 19 are false.
Voted in the past 5 years, if any of the date variables in the past 5 years, aside from the recent midterm, have a vote.
Voted in the past 10 years, if no votes were cast in the past 5 but there were votes in the past 10.
And recently registered, which would involve the registration_dt variable which I feel more confident being able to implement.
I just really don't know how to turn these into one variable without losing information. Thanks so much :)