#6 : Write a function | Hackerrank Python Solutions

preview_player
Показать описание
Thanks if u r Watching us....
#Python #Dev19 #HackerankSOlutions #C #C++ #Java #Python
Please Subscribe Us ....
Рекомендации по теме
Комментарии
Автор

This is working


def is_leap(year):
leap = False

if(year%400==0):
leap = True

elif(year%100==0):
leap=False
elif(year%4==0):
leap=True
else:
leap=False
return leap

year = int(input())
print(is_leap(year))

emreulupnar
Автор

2100 - given Error..
Try Nested Condition..

if (year % 4 == 0):
if (year % 100 == 0):
if (year % 400 == 0):
leap = True
else:
leap = False
else:
leap = True
else:
leap = False

return leap

jrjivani
Автор

I used this

year=int(input("year:--"))
def leap(year):
Leap=((year%4)==0)
return bool(Leap)

print(leap(year))

hatim
Автор

def is_leap(year):
leap = False

# Write your logic here
if (year%400 == 0) or ((year%4 == 0) and (year%100 != 0)):
leap = True

return leap

Jefferson_Salunga
Автор

working one for all TCs

def is_leap(year):
leap = False


# Write your logic here
if(year%400==0):
leap = True

elif(year%100==0):
leap=False
elif(year%4==0):
leap=True
else:
leap=False
return leap


year = int(input())
print(is_leap(year))

nileshswami
Автор

Lecture number 6 Does not work for test case 1. If the year is 2100 it will satisfy the condition that year%4 == 0 but it will not satisfy the condition that year%400 ==0.

shubhamdeshpande
Автор

def is_leap(year)
If (year%400==0) or (year%4==0 and year%100!=0):
return True
else:
return False
Year=int(input())
print(leap_year)
I used this ✨

santhiya.p
Автор

wrong code...only applies for some cases...

ramapragadakomal
join shbcf.ru