From 330906f037d8114a10c2435d8ba629b26318f0b2 Mon Sep 17 00:00:00 2001 From: anhtran1405 Date: Fri, 20 Jan 2023 16:14:42 +0000 Subject: [PATCH 1/3] Complete leap.py --- .gitpod.yml | 10 ++++++++++ leap/leap.py | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .gitpod.yml diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 0000000..b1c4d2b --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,10 @@ +# This configuration file was automatically generated by Gitpod. +# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) +# and commit this file to your remote git repository to share the goodness with others. + +# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart + +tasks: + - init: pip install -r requirements.txt + + diff --git a/leap/leap.py b/leap/leap.py index 50fd034..3bb3a9d 100644 --- a/leap/leap.py +++ b/leap/leap.py @@ -1,2 +1,8 @@ def leap_year(year): - pass + if year % 400 == 0: + return True + elif year % 100 == 0: + return False + else: + return False +#print(leap_year(1900)) \ No newline at end of file From 4589101c9dfd9d851a85a220e28614e8b2db7b4e Mon Sep 17 00:00:00 2001 From: anhtran1405 Date: Fri, 20 Jan 2023 16:21:18 +0000 Subject: [PATCH 2/3] Complete leap.py --- leap/leap.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/leap/leap.py b/leap/leap.py index 3bb3a9d..55171ba 100644 --- a/leap/leap.py +++ b/leap/leap.py @@ -3,6 +3,8 @@ def leap_year(year): return True elif year % 100 == 0: return False + elif year % 4 == 0: + return True else: return False #print(leap_year(1900)) \ No newline at end of file From 28617435643c7c9e7e8ba1784e1420556ab2604c Mon Sep 17 00:00:00 2001 From: anhtran1405 Date: Fri, 20 Jan 2023 16:49:20 +0000 Subject: [PATCH 3/3] Complete Darts --- darts/darts.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/darts/darts.py b/darts/darts.py index 4ba1b3b..587162e 100644 --- a/darts/darts.py +++ b/darts/darts.py @@ -1,2 +1,14 @@ -def score(x, y): - pass +def score(x,y): + distance = (x**2 + y**2)**(1/2) + if distance <= 1: + return 10 + elif distance <= 5 and distance > 1: + return 5 + elif distance <= 10 and distance > 5: + return 1 + else: + return 0 + +print(score(0.8,0.8)) +print(score(-5,0)) +print(score(0,-1)) \ No newline at end of file