My issue
Write a program which does the following
You are given a list consisting of 12 integers - the number of days in each month in a year
You need to iterate through the loop and exit the loop if you find any integer which is not 30 or 31
Output this anomaly to the console
My code
# Given list of days in each month
days_in_months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
# Iterate through the list to find anomalies
for idx, days in enumerate(days_in_months, start=1):
if days not in [30, 31]:
print(days)
break
Learning course: Python with Data structures
Problem Link: CodeChef: Practical coding for everyone