From d0f519a9706e2ea23174698ad7a0298c2fe3576c Mon Sep 17 00:00:00 2001 From: FitriRibbit <91612800+FitriRibbit@users.noreply.github.com> Date: Mon, 19 Sep 2022 08:00:50 -0700 Subject: [PATCH] Update leap year checker.py Made input from user and replay game feature --- leap year checker.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/leap year checker.py b/leap year checker.py index 86f0845..bffe4f9 100644 --- a/leap year checker.py +++ b/leap year checker.py @@ -1,13 +1,25 @@ def is_leap_year(year): - if year % 4 == 0: + if year % 4 == 0 : if year % 100 == 0: if year % 400 == 0: - print('Leap Year' ) + print('Leap Year') else: - print('Not leap year') + print('Not Leap Year') else: - print('Leap year' ) + print('Leap Year') else: print('Not Leap Year') -is_leap_year(2051) + +input_year = int(input('Input Year : ')) #made user input year +is_leap_year(input_year) + +#code to replay again +while True: + input_text = input('Still Wanna Input Year? (y/n) ') + if input_text == 'Y' or input_text == 'y': + input_year1 = int(input('Input Year : ')) + is_leap_year(input_year1) + else: + quit() +