Created
September 17, 2020 12:08
-
-
Save gmariette/29bb300070a95ee477ca899a44b1fca1 to your computer and use it in GitHub Desktop.
weightlifting class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') | |
| class weightlifting: | |
| def __init__(self): | |
| self.woman_barbell = 15 | |
| self.man_barbell = 20 | |
| self.gender = "F" | |
| self.total_weight = 0 | |
| def genderBarbell(self): | |
| if self.gender.upper() == "F": | |
| self.barbell = self.woman_barbell | |
| logging.debug("You're a woman") | |
| else: | |
| self.barbell = self.man_barbell | |
| logging.debug("You're a man") | |
| logging.info("Your barbell's weight is %s", self.barbell) | |
| self.total_weight = self.barbell | |
| def addWeight(self, add): | |
| try: | |
| self.barbell | |
| self.total_weight += add | |
| logging.info("Your barbell is now %s", self.total_weight) | |
| except: | |
| logging.error("You forgot to init your barbell, please call genderBarbell function first !") | |
| def cleanAndJerk(self): | |
| if self.total_weight > 0: | |
| if self.gender == "F" and self.total_weight < 80: | |
| logging.info("Congrats, you've jerked %s easily", self.total_weight) | |
| return | |
| if self.gender == "M" and self.total_weight < 100: | |
| logging.info("Congrats, you've jerked %s easily", self.total_weight) | |
| return | |
| logging.error("Weight is too high for you ! Decrease weight even if there is no function for that because it is a tutorial !") | |
| return | |
| else: | |
| logging.error("Cannot clean and jerk here, please init your barbell, please call genderBarbell function first !") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment