How do I use a variable inside an if statement in python? For example, month_report contains:
October
November
December
January
and cycle_report contains:
October,Monthly
November,Monthly
November,Quarterly
January,Monthly
Below is how I would think variable can be used.
mcount = 0
qcount = 0
ncount = 0
for month in month_report:
for x in cycle_report:
if x == "{month},Monthly":
mcount += 1
elif x == "{month},Quarterly":
qcount += 1
else:
ncount += 1
cycle_reportmap? If so, then it would becycle_report[month], as value would be report. If full"{month},Monthly"is key, then you would have to format it before checking.f"{month},Monthly"?f"{month},Monthly"?