1
0
forked from tdwojak/Python2018
Python2018/labs02/task02.py

28 lines
659 B
Python
Raw Normal View History

2018-05-12 11:37:19 +02:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Napisz funkcję days_in_year zwracającą liczbę dni w roku (365 albo 366).
"""
2018-05-13 12:56:50 +02:00
def days_in_year(days):
if (days % 4 == 0 and ((days % 100 != 0) or days % 400 == 0)):
return 366
else:
return 365
2018-05-12 11:37:19 +02:00
def days_in_year(days):
pass
def tests(f):
inputs = [[2015], [2012], [1900], [2400], [1977]]
outputs = [365, 366, 365, 366, 365]
for input, output in zip(inputs, outputs):
if f(*input) != output:
return "ERROR: {}!={}".format(f(*input), output)
break
return "TESTS PASSED"
if __name__ == "__main__":
print(tests(days_in_year))