I'm creating a program to determine whether or not a given year is a leap year. I just wanted to get anyone's feedback on it. I am aware of the calendar module in Python. I just wanted to try it from scratch.year=int(raw_input(Input year:))if (year%4==0 and year%100==0 and year%400==0)or (year%4==0 and year%100 !=0 and year%400==0)or(year%4==0 and year%100 !=0 and year%400!=0):  print str(year)+ is a leap yearelse:    print str(year)+ is NOT a leap year
Leap year calculator
python;beginner;datetime
LogicConsider the if condition, which I have reproduced below with different alignment for ease of viewingif (year%4==0 and year%100==0 and year%400==0)or \   (year%4==0 and year%100!=0 and year%400==0)or \   (year%4==0 and year%100!=0 and year%400!=0):    It's clear that the first two lines can be collapsed due to redundancy.  As for the third line, any number that is not divisible by 100 is automatically not divisible by 400 as well.if (year%4==0 and year%400==0)or \   (year%4==0 and year%100!=0):    That can be further simplified to:if (year%4==0 and (year%100!=0 or year%400==0)):    FormattingPlease take care to follow Python formatting conventions, especially the consistent indentation by four spaces, especially since whitespace is significant in Python.year = int(raw_input(Input year: ))if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0):    print str(year) +  is a leap yearelse:    print str(year) +  is NOT a leap year