From b9cb54dd9d6f746876d2eff30e3852bbce1f08db Mon Sep 17 00:00:00 2001 From: Keerthiraj-Manickam <149758652+Keerthiraj-Manickam@users.noreply.github.com> Date: Tue, 16 Jul 2024 21:00:54 +0530 Subject: [PATCH] Update sports.py I have add a functionalities as "Rest periods" --- sports.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sports.py b/sports.py index c099cc3..a947fcf 100644 --- a/sports.py +++ b/sports.py @@ -37,6 +37,15 @@ def nutrition(self, meal_type): self.stamina = 50 print(f"{self.myplayer} had a {meal_type} meal. Current stamina: {self.stamina}") + def rest(self, time_period): + if time_period.lower() == 'short': + self.stamina += 10 + elif time_period.lower() == 'long': + self.stamina += 25 + if self.stamina > 50: + self.stamina = 50 + print(f"{self.myplayer} took a {time_period} rest. Current stamina: {self.stamina}") + def event_summary(self): print(f"Player: {self.myplayer}") print(f"Current Stamina: {self.stamina}")