[Solved] How to avoid used many if statements in definition?
Use a for loop to iterate over the months: def prepareadres(city,y,m,d): months = [31,28,31,30,31,30,31,31,30,31,30,31] d = d + 1 d0 = 0 m0 = 0 for month in months: if d > month: d = d – month m += 1 if d == sum(months): print(“year complete”) #print(df.iloc[0, :-2]) if (m < 10) and (d … Read more