Python Forum
Filtering with IF Statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filtering with IF Statement
#8
read all of the rows into a list
input all 4 of the conditions before checking anything.
for each item in list
if list_state == state and list_disease == disease and list_year == year
and list_State_Disease_Number_Year == State_Disease_Number_Year:
print results and tally totals
print totals.
I's also use fstrings for print statements, like:
print(f"\n{titleLocation:25} {titleDisease:15} {titleNumber:15} {titleYear:15}\n")
and
print(f"{state:25} {disease:15} {number:15} {year:15}")
Reply


Messages In This Thread
Filtering with IF Statement - by Mike2607 - Nov-28-2019, 09:40 PM
RE: Filtering with IF Statement - by Larz60+ - Nov-28-2019, 09:44 PM
RE: Filtering with IF Statement - by Mike2607 - Nov-28-2019, 10:09 PM
RE: Filtering with IF Statement - by Larz60+ - Nov-28-2019, 11:35 PM
RE: Filtering with IF Statement - by Mike2607 - Nov-29-2019, 01:31 AM
RE: Filtering with IF Statement - by Larz60+ - Nov-29-2019, 01:58 AM
RE: Filtering with IF Statement - by Mike2607 - Nov-29-2019, 02:05 AM
RE: Filtering with IF Statement - by Larz60+ - Nov-29-2019, 04:56 AM
RE: Filtering with IF Statement - by perfringo - Nov-29-2019, 08:20 AM
RE: Filtering with IF Statement - by Mike2607 - Nov-29-2019, 01:59 PM
RE: Filtering with IF Statement - by perfringo - Nov-29-2019, 07:18 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020