From 0e5da5a08105ac626778f40f9e65001106e13696 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Thu, 11 Apr 2024 03:42:33 +0530 Subject: [PATCH 1/5] hello World #1 --- practice/hello-world/hello_world.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/practice/hello-world/hello_world.py b/practice/hello-world/hello_world.py index adaa6c2..d695ea1 100644 --- a/practice/hello-world/hello_world.py +++ b/practice/hello-world/hello_world.py @@ -1,2 +1,2 @@ def hello(): - return 'Goodbye, Mars!' + return 'Hello, World!' From 95931877024fdd8519820db0b0e83f9b8c16a9e0 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Thu, 11 Apr 2024 23:48:39 +0530 Subject: [PATCH 2/5] Revert "hello World #1" This reverts commit 0e5da5a08105ac626778f40f9e65001106e13696. --- practice/hello-world/hello_world.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/practice/hello-world/hello_world.py b/practice/hello-world/hello_world.py index d695ea1..adaa6c2 100644 --- a/practice/hello-world/hello_world.py +++ b/practice/hello-world/hello_world.py @@ -1,2 +1,2 @@ def hello(): - return 'Hello, World!' + return 'Goodbye, Mars!' From d17fc96807c746982d294c40d3968fda4aca4c62 Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Mon, 15 Apr 2024 01:35:17 +0530 Subject: [PATCH 3/5] high-scores --- .../__pycache__/high_scores.cpython-39.pyc | Bin 0 -> 895 bytes .../high_scores_test.cpython-39-pytest-6.2.4.pyc | Bin 0 -> 3618 bytes practice/high-scores/high_scores.py | 11 ++++++++++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 practice/high-scores/__pycache__/high_scores.cpython-39.pyc create mode 100644 practice/high-scores/__pycache__/high_scores_test.cpython-39-pytest-6.2.4.pyc diff --git a/practice/high-scores/__pycache__/high_scores.cpython-39.pyc b/practice/high-scores/__pycache__/high_scores.cpython-39.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea8004ca6231317627c39110ffb018b4fa9c73ce GIT binary patch literal 895 zcmaJAzK`9N<_twA&R zRGf~Jyh3AhuCo-5Sr17q6P}AXC}NYqLc|Nv1lC=OWaC>?o}f=>7Jvb{+x-vk(&Oai zVWmxaYO6do7Y6gfPSP1>d0pft9TV)EwuFmS8}H4&HK9_)w5XM0eCtSw@6R51?k)2< zwQnUHuM>tdYTI)n9Lf0Rjs&^23xPdyj%aK8v}}ShtBtKWwS?U4K(^Wc1J*EyGjS;r zKqf++@g~`YYYcJ+|AZXQ4BBd%mFhDghaKdd4)WTeM+CU*ZbaJ@v;=tYKP5dI?}v1M z@5e`xX!>Zr5}vu?CJ?v4R#+STZ+crR2Tcr8^_hjIO_8pr`g0P)eMxH zRQkN+_^DD~&a<-3ApbRTSsb$2WW!IWV|YBs(`B`MArzsSA literal 0 HcmV?d00001 diff --git a/practice/high-scores/__pycache__/high_scores_test.cpython-39-pytest-6.2.4.pyc b/practice/high-scores/__pycache__/high_scores_test.cpython-39-pytest-6.2.4.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b292a5e02df2a882f6e6c3c3e1dce09c2461d419 GIT binary patch literal 3618 zcmb_fOK;mo5MDkcQ7=2TlQ>QvahxWNkVa_I76nqHaFMhrdho?T4}^dPqg`1vC{f*| z;n=WG$q%u6(_iAXC;f$hY)n2j zH1^<=uRt)ujDWa?D$R~%5`%PXH)rUPyqkv+GbnT%*D=Uz!YpQgAk60ZqvCtZEivPO z)N%vRMD}Y&T>9NVY#%g3!DSQsCLa?Td+^Bs1XsW5n#^G42jW^E!9m+D>U^k(xuv_dllvTFL?m)T1wqSpEj}6%COns@3?6CveW1ZuNnDG-e?2CPqi{tr@BrffK~6E#v53nfe#{V4F{{B zTjoI!!-4l~XPS+A%93n`z5+EPhM0LV!Oo?5MG}5$7V^Vjwm`NAF4l4*QL{u5>zbUv z!z~E#R!xLrL##qGUelXX6EvK4=pLi7jkE1kG!qN12a7d$jN4m7;f!iiFseN+WZ3lr z`Zf#AxU3D%_E=VWjtx<@0UVOQL-2`#-Bs;0wgn_Ty$ErHI?UQ z;`(MGE)TE;TuOlHb?J9cX5jtwG4N(|WuwIV8n8h;Q!*Q&xv!0y3GVSiaA35s8=QjR z-zLEFM&3C4@ne8Z=$QhAAsRmwrtud>7aaznh+ufWu+FVZ;|fw32-zmot+{}tuWpQm z`m`!HRnBXxSS0S^kP1y3Q0v>Gf*tCb#4zfX@KouTtD_VKZXK$gD1LM-)1iubt%wUc zbqngXKfo%f@-zs@whqfL(rEgB>av-_++@Vmu*_iV$V!5@K&ESRlqeduVQ3b*KF`Bc zBop*5tQ>>JOaw0P)HA(IQ8wI9bc}vZy91u?0p=Y8bqeOZ<2GU+dxzM@rgDJ93p5pr z%!b*4^5Pl$r&6&@Q8pEyX89Ui0}lY!$oL83Oyl2EexGhL#QF!Qn>Bkq&DXP4?AKOf zhtjUs;grTDN;@Gt4zOOK6tiqSB5t5TFcTM;R*BD0V7ef_K!M4+xQ7CRsn|h*F-Cli zBC+Gxn8JbqyZ|I-Lg25tnYZA;t7g^8vGexW4 Date: Mon, 22 Apr 2024 03:08:36 +0530 Subject: [PATCH 4/5] removed cache files --- .../__pycache__/high_scores.cpython-39.pyc | Bin 895 -> 0 bytes .../high_scores_test.cpython-39-pytest-6.2.4.pyc | Bin 3618 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 practice/high-scores/__pycache__/high_scores.cpython-39.pyc delete mode 100644 practice/high-scores/__pycache__/high_scores_test.cpython-39-pytest-6.2.4.pyc diff --git a/practice/high-scores/__pycache__/high_scores.cpython-39.pyc b/practice/high-scores/__pycache__/high_scores.cpython-39.pyc deleted file mode 100644 index ea8004ca6231317627c39110ffb018b4fa9c73ce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 895 zcmaJAzK`9N<_twA&R zRGf~Jyh3AhuCo-5Sr17q6P}AXC}NYqLc|Nv1lC=OWaC>?o}f=>7Jvb{+x-vk(&Oai zVWmxaYO6do7Y6gfPSP1>d0pft9TV)EwuFmS8}H4&HK9_)w5XM0eCtSw@6R51?k)2< zwQnUHuM>tdYTI)n9Lf0Rjs&^23xPdyj%aK8v}}ShtBtKWwS?U4K(^Wc1J*EyGjS;r zKqf++@g~`YYYcJ+|AZXQ4BBd%mFhDghaKdd4)WTeM+CU*ZbaJ@v;=tYKP5dI?}v1M z@5e`xX!>Zr5}vu?CJ?v4R#+STZ+crR2Tcr8^_hjIO_8pr`g0P)eMxH zRQkN+_^DD~&a<-3ApbRTSsb$2WW!IWV|YBs(`B`MArzsSA diff --git a/practice/high-scores/__pycache__/high_scores_test.cpython-39-pytest-6.2.4.pyc b/practice/high-scores/__pycache__/high_scores_test.cpython-39-pytest-6.2.4.pyc deleted file mode 100644 index b292a5e02df2a882f6e6c3c3e1dce09c2461d419..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3618 zcmb_fOK;mo5MDkcQ7=2TlQ>QvahxWNkVa_I76nqHaFMhrdho?T4}^dPqg`1vC{f*| z;n=WG$q%u6(_iAXC;f$hY)n2j zH1^<=uRt)ujDWa?D$R~%5`%PXH)rUPyqkv+GbnT%*D=Uz!YpQgAk60ZqvCtZEivPO z)N%vRMD}Y&T>9NVY#%g3!DSQsCLa?Td+^Bs1XsW5n#^G42jW^E!9m+D>U^k(xuv_dllvTFL?m)T1wqSpEj}6%COns@3?6CveW1ZuNnDG-e?2CPqi{tr@BrffK~6E#v53nfe#{V4F{{B zTjoI!!-4l~XPS+A%93n`z5+EPhM0LV!Oo?5MG}5$7V^Vjwm`NAF4l4*QL{u5>zbUv z!z~E#R!xLrL##qGUelXX6EvK4=pLi7jkE1kG!qN12a7d$jN4m7;f!iiFseN+WZ3lr z`Zf#AxU3D%_E=VWjtx<@0UVOQL-2`#-Bs;0wgn_Ty$ErHI?UQ z;`(MGE)TE;TuOlHb?J9cX5jtwG4N(|WuwIV8n8h;Q!*Q&xv!0y3GVSiaA35s8=QjR z-zLEFM&3C4@ne8Z=$QhAAsRmwrtud>7aaznh+ufWu+FVZ;|fw32-zmot+{}tuWpQm z`m`!HRnBXxSS0S^kP1y3Q0v>Gf*tCb#4zfX@KouTtD_VKZXK$gD1LM-)1iubt%wUc zbqngXKfo%f@-zs@whqfL(rEgB>av-_++@Vmu*_iV$V!5@K&ESRlqeduVQ3b*KF`Bc zBop*5tQ>>JOaw0P)HA(IQ8wI9bc}vZy91u?0p=Y8bqeOZ<2GU+dxzM@rgDJ93p5pr z%!b*4^5Pl$r&6&@Q8pEyX89Ui0}lY!$oL83Oyl2EexGhL#QF!Qn>Bkq&DXP4?AKOf zhtjUs;grTDN;@Gt4zOOK6tiqSB5t5TFcTM;R*BD0V7ef_K!M4+xQ7CRsn|h*F-Cli zBC+Gxn8JbqyZ|I-Lg25tnYZA;t7g^8vGexW4 Date: Mon, 22 Apr 2024 15:57:34 +0530 Subject: [PATCH 5/5] improved the code --- practice/high-scores/high_scores.py | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/practice/high-scores/high_scores.py b/practice/high-scores/high_scores.py index 273f77a..d14c006 100644 --- a/practice/high-scores/high_scores.py +++ b/practice/high-scores/high_scores.py @@ -1,12 +1,64 @@ class HighScores: + """ + A class to represent a collection of high scores. + + ... + + Attributes + ---------- + scores : list + a list of integers representing the scores + + Methods + ------- + latest(): + Returns the latest (last) score. + personal_best(): + Returns the highest score. + personal_top_three(): + Returns the three highest scores, sorted in descending order. + """ + def __init__(self, scores): + """ + Constructs all the necessary attributes for the HighScores object. + + Parameters + ---------- + scores : list + a list of integers representing the scores + """ self.scores = scores def latest(self): + """ + Returns the latest (last) score. + + Returns + ------- + int + The latest score + """ return self.scores[-1] def personal_best(self): + """ + Returns the highest score. + + Returns + ------- + int + The highest score + """ return max(self.scores) def personal_top_three(self): + """ + Returns the three highest scores, sorted in descending order. + + Returns + ------- + list + The three highest scores + """ return sorted(self.scores, reverse=True)[:3] \ No newline at end of file